SELECT [Exhibitor].[Exhibitor_Ref], [Exhibitor].[Exhibitor_Name], [Exhibitor].[Tel]
FROM Exhibitor, Exhibitions, Booking
WHERE [Exhibitions].[Exhibition_Name]=Form1.Combo1="Chris";
The combo box is to provide the available 'exhibitions' from the Exhibitions table.
I want to display the SELECT data when the value of the combo box matches that of a exhibition name (and another yes/no variable which works!)
I am just having trouble getting the query to recognise the value of the combo box.
Any advice on this aspect would be gratefully received
erm, your advice doesnt quite help Rick..that pulls no data...Im guessing that it still doesnt recognise the combobox value?
Tia's comment about turning it to a text value, seems logical but I still cant get it to recognise the inserted value (which is pulled from the Exhibitions table)
In looking again at your SQL, the FROM clause would also cauase a problem....
SELECT [Exhibitor].[Exhibitor_Ref], [Exhibitor].[Exhibitor_Name], [Exhibitor].[Tel]
FROM Exhibitor, Exhibitions, Booking
WHERE [Exhibitions].[Exhibition_Name]=Form1.Combo1="Chris";
You need to specify how & what fields are to be joined
I thought combo was populated fine
And if it is - then [Forms]![frm_Name]![combobox].Value
will do the trick
Whatever Value selected in combobox will be read from the form. If it is not - there is another problem
If using sql in VBA, the following would recognize the combo box:
SELECT [Exhibitor].[Exhibitor_Ref], [Exhibitor].[Exhibitor_Name], [Exhibitor].[Tel]
FROM Exhibitor INNER JOIN Booking ON [Exhibitor].[Exhibitor_Ref]=[Booking].[Exhibitor_Ref], Exhibitions
WHERE [Exhibitions].[Exhibition_Name] ='" & Forms!Form1!Combo1 & "' AND [Booking].[Paid] = 0;
If sql in a query, the following should recognize it:
SELECT [Exhibitor].[Exhibitor_Ref], [Exhibitor].[Exhibitor_Name], [Exhibitor].[Tel]
FROM Exhibitor INNER JOIN Booking ON [Exhibitor].[Exhibitor_Ref]=[Booking].[Exhibitor_Ref], Exhibitions
WHERE [Exhibitions].[Exhibition_Name] = Forms!Form1!Combo1 AND [Booking].[Paid] = 0;
Ofcourse it will not recognize values in combobox
It has wrong syntax, that's all
SELECT [Exhibitor].[Exhibitor_Ref], [Exhibitor].[Exhibitor_Name], [Exhibitor].[Tel]
FROM Exhibitor INNER JOIN Booking ON [Exhibitor].[Exhibitor_Ref]=[Booking].[Exhibitor_Ref], Exhibitions
WHERE [Exhibitions].[Exhibition_Name] = [Forms]![Form1]![Combo1].VALUE AND [Booking].[Paid] = 0;
The only other reason that I can see that the value in your combo box would not be recognized is that the value you're looking to capture IS NOT in the bound column of the combo box........
You mean now , after you corrected syntax it pulls the same data ?
Could it be that [Exhibitions].[Exhibition_Name] only has data for value in combobox?
SELECT [Exhibitor].[Exhibitor_Ref], [Exhibitor].[Exhibitor_Name], [Exhibitor].[Tel]
FROM Exhibitor INNER JOIN Booking ON [Exhibitor].[Exhibitor_Ref]=[Booking].[Exhibitor_Ref]
WHERE [Booking].[Exhibition_Name]=[Forms]![Form1]![Combo1].Value And [Booking].[Paid]=0;
The final solution!!!
Thanks to you all. All responses were helpful and gratefully receieved!!!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.