Hi.
I got a Form "X" that has a lot of comboboxes and texboxes. This form also has a subform "Y" that display a table with the results of a query that depends on the comboboxes and texboxes of Form "X".
Now I'm using in the criteria of the query the texts of the different comboboxes with the operator OR. I would like to use an AND but because only one combobox has the focus at the moment it only takes the text of that one for making the query, so the result is allways blank.
How can I trigger a VBA procedure with a button in the form "X" to do the query and show the correct data on the subform/form. How can I do the query with VBA?
This is the SQL code:
SELECT LogDatafill_Table_NORCROSS.[Tracking Number], LogDatafill_Table_NORCROSS.Request, LogDatafill_Table_NORCROSS.Date, LogDatafill_Table_NORCROSS.Time, LogDatafill_Table_NORCROSS.APPROVED, LogDatafill_Table_NORCROSS.Tech, LogDatafill_Table_NORCROSS.RNWE, LogDatafill_Table_NORCROSS.Comment, LogDatafill_Table_NORCROSS.Hyperlink
FROM LogDatafill_Table_NORCROSS
WHERE (((LogDatafill_Table_NORCROSS.Market)=[Forms]![LogFileForm]![ComboMarketText].[Text])) OR (((Left([ID],5))=[Forms]![LogFileForm]![LogIDTxt].[Text])) OR (((LogDatafill_Table_NORCROSS.Date)=[Forms]![LogFileForm]![cboStartDate].[Text])) OR (((LogDatafill_Table_NORCROSS.Request)=[Forms]![LogFileForm]![Combo8].[Text]))
ORDER BY Left([ID],5);
Thanks!
Daniel
I got a Form "X" that has a lot of comboboxes and texboxes. This form also has a subform "Y" that display a table with the results of a query that depends on the comboboxes and texboxes of Form "X".
Now I'm using in the criteria of the query the texts of the different comboboxes with the operator OR. I would like to use an AND but because only one combobox has the focus at the moment it only takes the text of that one for making the query, so the result is allways blank.
How can I trigger a VBA procedure with a button in the form "X" to do the query and show the correct data on the subform/form. How can I do the query with VBA?
This is the SQL code:
SELECT LogDatafill_Table_NORCROSS.[Tracking Number], LogDatafill_Table_NORCROSS.Request, LogDatafill_Table_NORCROSS.Date, LogDatafill_Table_NORCROSS.Time, LogDatafill_Table_NORCROSS.APPROVED, LogDatafill_Table_NORCROSS.Tech, LogDatafill_Table_NORCROSS.RNWE, LogDatafill_Table_NORCROSS.Comment, LogDatafill_Table_NORCROSS.Hyperlink
FROM LogDatafill_Table_NORCROSS
WHERE (((LogDatafill_Table_NORCROSS.Market)=[Forms]![LogFileForm]![ComboMarketText].[Text])) OR (((Left([ID],5))=[Forms]![LogFileForm]![LogIDTxt].[Text])) OR (((LogDatafill_Table_NORCROSS.Date)=[Forms]![LogFileForm]![cboStartDate].[Text])) OR (((LogDatafill_Table_NORCROSS.Request)=[Forms]![LogFileForm]![Combo8].[Text]))
ORDER BY Left([ID],5);
Thanks!
Daniel