|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Pls help me... on how can I select data from my combo box and pass the selected list to the other form? can you please give me a sample code. Many Thanks.
|
|
#2
|
|||
|
|||
|
You can transfer the selected combo box value to another control of any open form by using the AfterUpdate event of the combo box.
Assuming that the name of the combo box is [ComboBox] and the control name is [TextBox] and the form to be transfered to is named [OpenForm], this is what the code would be: Sub ComboBox_AfterUpdate() Forms![OpenForm]![TextBox].Value = Me![ComboBox].Value OR Forms![OpenForm]![TextBox] = Me![ComboBox] End Sub Note: The reference .Value is optional. |
|
#3
|
|||
|
|||
|
Another option without code would be to make the default value of your textbox to equal the combobox value providing that the form in which your combobox is on remains open when you open your second form. If your second form is already open you will need to refresh the form to see the results.
=[Form]![ComboBoxForm]![ComboBox].Value Depending on your program flow there are several different ways to approach this. If you need specific help with your particular forms, give us more detail in how you are executing opening the second form from your first form and what is in your combobox, i.e. number of columns etc. lwells |
|
#4
|
|||
|
|||
|
Combobox Query kinda works..help!
Ok, I have a form with unbound combo boxes that collect the user options to return data from a query. If I compete ALL the fields by choosing from the combo boxes I get the correct data returned to me.
However, I am trying to create a completely customized report from this query so for instance... BOX A - TYPE OF ASSET BOX B - TYPE OF PROBLEM BOX C - FOR LAST X NUMBER DAYS If I devide I want all the record for the type of assett in the last 30 days and pick the type of assett in box a and 30 days in box c, then leave box B as the default value, currently NULL. then I get no data back. What I want back for data is all records of that assett type, for that date period, with all types of problems. And vice versa with all boxes. totally user definable report. The only thing I want to force them to do is pick at least one assett type, otherwise they can have all of the data on that assett or limit it as they see fit. Thanks in advance |
|
#5
|
|||
|
|||
|
Hi Ramjet
You can use the code I gave qazig in their post to guide you on building a QBF (query by form) In your case you would force the entry of the BoxA - Type of Asset by using the following in the OnClick of the command button prior to running the Function If IsNull(BoxA) Then Msgbox "Must Make An Asset Selection First" DoCmd.CancelEvent BoxA.SetFocus End If lwells |
|
#6
|
|||
|
|||
|
Thanks, that will force the one box input. I am still having problems with the null fields in the other boxes not returning a report. I have used a parameter query based on the combo boxes and if they are all not complete it does not produce any data. I have tried setting the criteria in the query to [FORMS]![THATFORM] or If Null Like "*" hoping that if the field is null it will use the wildcard to return all of the data for that field. I want the combo boxes to drill down the data on the specifics for the user, otherwise if there is no criteria defined by the user they get all of the data for that field.
Quote:
|
|
#7
|
|||
|
|||
|
Hi Ramjet
If you will look at the code I gave qazig in their post, it has the code to handle Null values like you want. Thread http://forums.devarticles.com/t10699/s.html lwells |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > how can i select from my combo box? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|