I bind a list of jobtype values to a gridview, each row have sno,jobtype,check box,and a text box. when a check box is checked the text box will enable, and I have to enter some value(like fee) here I can check multiple jobtypes,and enter fee in text box, and finally save these values( jobtype, fee) I successfully bind the data, but how to get that entered value from text box of each row?? And how can I enable or disable text box on checked or unchecked the check box.. Please give me solution
You cant have JobType as the DataContext for row.
You need to build a wrapper around it, that will contain JobType, and the other strings you wish your TextBoxes to Bind to.
Your list of JobTypes should be a list of that wrapper.
Related
I have a combo box (myCB) in a form. The user can either select a drop down value or type a value in the box. When the user clicks a button, I want to get the value in the combo box for use in a query.
I am using myCB.Column(0) to grab the value. This works if the user has clicked a selection in the combo box. However, if the user has typed the value, then myCB.Column(0) is null. I have also tried myCB.Text and myCB.Value. Both give null.
How can I grab the combo box value regardless of whether it was selected or typed?
Edited to add properties:
Row Source: "SELECT DISTINCT Item FROM tblItems" (this is set in VBA code, and not in property sheet)
Bound Column: 1
Column Count: 1
Column Widths:
Control Source: ItemName
Figured it out. I was grabbing the combo box value after DoCmd.GoToRecord , "", acNewRec in the OnClick procedure, and the behavior was wonky. Running the value-testing stuff before a new record is accessed yields the correct behavior. Thank you everyone for your help.
I have a combo box in a form which has two options : correct and incorrect. There is another textbox field which is set not required in Required field property of the table but when combo box selection makes "incorrect", it should automatically force user to fill in textbox i.e. mandatory to fill in textbox
Could anyone please help me out how to fix this.
Thanks!
On the After Update event of the combo box check the selected value. If it is "incorrect" set the focus to the textbox and then use the After Update event of the text box to verify the conditions for filling the text box are satisfied otherwise reset the focus back to the text box (and possibly put on a message box to explain why).
In access I am trying to get my total value to be equal to the sum of the all of the different values where the order number is the same.
My current code is as follows;
= SUM( Forms![OrderLine]![Total] ) Where( Forms![OrderLine]![OrderNo] = [OrderNo] )
This however gives me an error. How else would this be done?
Thanks
It sounds like you have an Order form and an OrderLine subform. Add a Form header/footer to your OrderLine form and put a text box in the footer. Put a SUM function in the Control Source of the footer text box to generate the aggregated value you need from the order line item rows.
On your main form, set the Control Source of the text box you want to display the order total equal to the name of the invisible text box in the subform. The control source on the main form text box will resemble SubformControlName.Form.AggregateTextBoxName.
You may need to play with the visibility settings of the header/footer, text box, form view mode, etc. to get the presentation you want, but this works even with the subform in datasheet view. The key is to get a text box somewhere on the subform to calculate the value you need on the parent form and then reference it inside the subform control from the parent form.
I have an Access Table named Count. It has one field named Anz and it has only 1 record. I want to Show this record in a TextBox on a form named overview. So in the design mode of the form inside the TextBox I use the code
[Count]![Anz]
but it Returns me #Name? error when I Switch back to form mode. Where am I going wrong?
You can use in Control Source of your unbound text box =Dlookup("[Anz]","[Count]")
Also you can bound your form to Count table and use for text box control source Anz
I want to use the table "services" which is filled with (id, service, price) at the moment i have a combo box (combo51) which lists all of those. now i have to get price from the selected thing in the combo box and get the price for it.
i have a query, but honestly i have no idea how to apply it to the text box and if it would even work.
SELECT price
FROM services
WHERE Services="Combo51";
From what i've seen in other topics they don't really make much sense to me, if someone could just explain basically what i have to do it'd be appreciated.
You shouldn't need to query the db after the combobox values are populated. Set the bound column property of the combobox to whatever value you want, and access it with combo51.value
If you insist on querying the db again, try something like this (assuming ID is the bound column):
msgbox dlookup("price", "services", "id=" & combo51.value)
You are already halfway. In the VBA code dialog, you can refer to the ID easily, e.g.
Debug.Print Combo51
but if you want the price, assuming the price is the third column in your table, use
Debug.Print Combo51.Columns(2)
So, if you want it displayed in a separate text box, add an 'On Change' event to the combo box and add the following code:
TextBox = Combo51.Columns(2)
Now every time you make a selection in the combo box the price will be displayed.