Buttons and Row Source Urgent

Florence1550

New member
Local time
Today, 13:36
Joined
Nov 25, 2006
Messages
3
I HAve A form with a combo box on it and when I Press the Button I Want to Change the row source of the conmbo box to:-

SELECT Street.SID, Street.Street, Postcode.Postcode
FROM Postcode INNER JOIN Street ON Postcode.PID = Street.Postcode
WHERE (((Postcode.Postcode) Like "*N1*"));

but the bit in red Like "*N!*" Seems to cause A problem in VBA

Could do with some help urgent pleas also how to spread vba code over multiple line in the SQL or row source statement
 
To get your statement to pass in VBA:
Code:
strSql = "SELECT Street.SID, Street.Street, Postcode.Postcode FROM Postcode INNER JOIN Street ON Postcode.PID = Street.Postcode WHERE (((Postcode.Postcode) Like """ & "*N1*" & """));"
Am I correct that you are searching for postcodes that have the combination "N1" within? What is "...the Button"? I guess you mean a command button to open this form? Need clarification. Is this statement static or dynamic -- is it always the same or will it change? If the same, stick it in the rowsource of the combobox.

If still need help, describe your setup - What form is "...the Button" on? How is the value "N1" generated? What is the form name the combobox is on? If you can design it so, it will be simpler to include the function that gets the value "N1" in the form where the combobox is - then all you have to do is say Me!cboAddress.RowSource = "SELECT..." and then Me!cboAddress.Requery.
 

Users who are viewing this thread

Back
Top Bottom