INSERT INTO prompts for value (1 Viewer)

temacc

New member
Local time
Today, 09:48
Joined
Jul 11, 2002
Messages
6
Help, I have this code and when it triggers a box prompts me for a value to be entered in... when I debug the program, ls_client has a value in it but it doesn't seem to want to take.

strSQL = "INSERT INTO Client_numbers (Client_num) VALUES (ls_client);"
DoCmd.RunSQL strSQL
 

RichMorrison

Registered User.
Local time
Today, 03:48
Joined
Apr 24, 2002
Messages
588
You wrote
<<
strSQL = "INSERT INTO Client_numbers (Client_num) VALUES (ls_client);"
DoCmd.RunSQL strSQL
>>

Access interprets this as one line of text. You told it that there is a field named Client_num and into this field you want it to insert the text "ls_client". But that isn't what you want.

strSQL = "INSERT INTO Client_numbers (Client_num) VALUES (" & ls_client & ");"
says insert the **value** of the variable ls_client.

RichM
 

Users who are viewing this thread

Top Bottom