Picking up data from list boxes

JahJr

Andy
Local time
Today, 05:43
Joined
Dec 3, 2008
Messages
93
I have 2 list boxes where the first one selects a category and the next one selects a product. Once the selections are made i need to be able to click log bet and get this information into a table "logged bets". I am completly lost on this. Below is the code that links the list boxes.

Private Sub cboCategories_AfterUpdate()
Me.cboProducts.RowSource = "SELECT ProductName FROM" & _
" Products WHERE CategoryID = " & Me.cboCategories & _
" ORDER BY ProductName"

Me.cboProducts = Me.cboProducts.ItemData(0)
End Sub

Any help would be greatly appreciated
 
Last edited:
If this is posted twice I am sorry. I poste a response about an hour ago and it never showed up.
I tried a new form with combo boxes and I am still lost. There are 5 list boxes on the form and I first need to get all the information selected and then click a button that will log all of this information to a table. Please explain to me how to do this. Sorry for being an idiot with this.
 
Create the form that has the recordsource to include the table that you want to update the data to.

Then create your comboboxs on the form and set the row source to include the options that you want the user to have based on whatever table you have the options saved in.

Then on that same combobox, select the Control Source to be the field that you want the binded selection to be "saved" to.

Make any sense?
 
I should be able to get it figured out with the file that you posted. Thank you so much.
 
Is there another way to do this. I'm guessing since we are selecting ControlSource. When you open the form the list boxes are automaticlly populated with the information of the first record in the Table. When you enter a new record it writes over the first record and then it continues to add new ones, until you close the form and reopen. Then it does the same thing and writes over the first record. Please help with how to fix this.
 
Do you only want to be able to enter new data with the form or do you want to be able to enter new data and also go back and change the old?
 
thank you I figured it out with using a on load event procedure for the form and the following code.

Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
End Sub
 

Users who are viewing this thread

Back
Top Bottom