Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using combo box selection in SQL statement 1

Status
Not open for further replies.

parkfairfax

Programmer
May 22, 2001
63
US
I am using VBA to launch several SQL statements. I am trying to accept results from a list or combo box on my form as the input for my SQL statement. Does anyone have an idea what I might do to get this to work.. Here is a copy of my code.

strSQL34 = "Update test_new_table set `Month` = [me!]. [combo9].value;"

The string works if I put text in ' *****' so I know that the statement works, but it seems like there is a problem transferring this combo box value into the SQL string.



 
just surround it with the characters required

strSQL34 = "Update test_new_table set `Month` =" & chr(39) &[me!].[combo9].value & chr(39)

to be such combobox entry will be "SQL SAFE" see other threads about apostrophes in sql statements


::)
 
Thank you for the quick answer to this problem. This is a valuable service.

I wish the problem had been that easy though. What I finally figured out was that I did not have a my form reference properly set up. Once I based my form on my table everything worked fine. I had to read about the theory before i could come to this conclusion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top