Hi,
I want to create a code in VBA which take a first value in my combobox (list of value from Table X), run a query and after go to next record from combobox.
Any ideas?
Hi,
I want to create a code in VBA which take a first value in my combobox (list of value from Table X), run a query and after go to next record from combobox.
Any ideas?
What does the query do, what do you want done with the data? Is it adding it to a table? If this is a continuous process, write a VBA routine to loop thru the records and run the query for each one.
What have you tried?
The combo box bound value is available to you using Me.YourComboName in VBA or you could refer to it directly in a saved action query.
I want to use value from combobox in query, but I don't understand how to go through next record?
I have a suspicion that you are using lookups at the table field level. Please tell us in plain English "what" you are trying to accomplish --no jargon and no database terms--plain English.
What does your table(s) represent?
I remain in ignorance as to what the query does, how it is to be used, what its purpose is. However, here is some code. It needs something to run it, a trigger of some sort, I have used a command button that will run this code when it is clicked.
Code:Private Sub Cmd_Loop_Click() Dim rst As Recordset, strSQL As String strSQL = "put the SQL for your combobox here" Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset) rst.MoveFirst Do Until rst.EOF DoCmd.RunSQL "put your query SQL here...." & rst!FieldName & "....;" rst.MoveNext Loop End Sub
mauryc1990,
I recommend that you tell us about your requirement/plan in plain, simple English. What exactly is your database/table design(s)?
Where is your combobox?
What is the rowsource of the combobox?