Hello,
I have a form with 2 list boxes (1 for buildings and 1 for room numbers) and 2 text boxes (1 for low room numbers 1 for high room numbers). I'm using these to filter a form. For the most part, all of my code works, however I'm having a tricky time getting the VBA based SQL statements to work. I know the query itself works in Access, as I built it in the Query builder before copying it into the code and tweaking it to how I thought would work. Generally speaking, I've gotten some of the more simple queries to work... but this one has a bit more to it... I'm thinking the issue is with how VBA is interpreting quotation marks and such... I'm just not sure how to go about making it work:
Your help and pointers are very appreciated.
Thank you in advance.
I have a form with 2 list boxes (1 for buildings and 1 for room numbers) and 2 text boxes (1 for low room numbers 1 for high room numbers). I'm using these to filter a form. For the most part, all of my code works, however I'm having a tricky time getting the VBA based SQL statements to work. I know the query itself works in Access, as I built it in the Query builder before copying it into the code and tweaking it to how I thought would work. Generally speaking, I've gotten some of the more simple queries to work... but this one has a bit more to it... I'm thinking the issue is with how VBA is interpreting quotation marks and such... I'm just not sure how to go about making it work:
Code:
"SELECT RM_Room_T.Room_ID, RM_Room_T.RoomNumber, RM_Room_T.Building_ID, RM_Room_T.Not_Dept " & _ "FROM RM_Room_T " & _ "WHERE (((RM_Room_T.RoomNumber) Between " & Nz(Me.RMLowFilter, "0") & " AND " & Nz(Me.RMHighFilter, "Z") & ") AND((RM_Room_T.Building_ID) Like ""*" & Nz(Me.BuildingList, "") & "*"")) " & _ "ORDER BY RM_Room_T.RoomNumber;"
Thank you in advance.
Comment