PDA

View Full Version : vba query problem



mwork
03-02-2008, 12:38 PM
Here is my code:
strSQL = "Select * FROM tblBuildingSize WHERE (length = '" & length & "') AND " & "(width = '" & width & "') AND " & "(height = '" & height & "');"

The values of length, width, and height will be something like 11'2". I think the quote sign(") is causing a problem but I'm not sure. Thanks to anyone that can help.

mwork
03-02-2008, 05:04 PM
I figured it out. I had to get rid of the (") and use chr$(34)


length = Replace(length, """", "")
width = Replace(width, """", "")
height = Replace(height, """", "")

strSQL = "Select * FROM tblBuildingsize WHERE (length = " & Chr$(34) & length & Chr$(34) & ") AND " & "(width = " & Chr$(34) & width & Chr$(34) & ") AND " & "(height = " & Chr$(34) & height & Chr$(34) & ");"