SQL simple error

swarv

Registered User.
Local time
Today, 18:32
Joined
Dec 2, 2008
Messages
196
Hi all,

I have the code below. Access asks me to type in a value for reasonwhy when it should just place the value for reasonwhy in the database

reasonwhy is called earlier with:
dim reasonwhy as string
reasonwhy = text30.text


Thanks

Code:
SQLText = "INSERT INTO absent ([start_date], [end_date], [days], [reason], [name]) SELECT  " & totalstartdate & ", " & totalenddate & ", " & TotalBusinessDays & ", " & reasonwhy & ", [Text18]"
 
If you require the value of reason why then it needs to bracketed by single quotes.

SQLText = "INSERT INTO absent ([start_date], [end_date], [days], [reason], [name]) SELECT " & totalstartdate & ", " & totalenddate & ", " & TotalBusinessDays & ", '" & reasonwhy & "', [Text18]"
 

Users who are viewing this thread

Back
Top Bottom