Insert Into probs.

BAzZ

Registered User.
Local time
Today, 15:57
Joined
Nov 13, 2002
Messages
60
when i run the following off the click event of a button, I get a "Enter Parameter Value" dialog box with the value of "me.txtTypeOfArea" followed by the input text field.

Code:
strSQLInsert = "INSERT INTO tblAreaTypeLookup ([txtTypeOfArea]) VALUES ([" & Me.txtAddTypeOfArea.Value & "]);"

DoCmd.RunSQL strSQLInsert

any reason why, this is actually the first time i've tried docmd.runsql, so for all i know it is made this way by design!

Other info, the forms record source is the table int he insert statement, "me.txtAddTypeOfArea" is an unbound txtbox.

Any help is greatly appreciated!
 
B,

Code:
String:
strSQLInsert = "INSERT INTO tblAreaTypeLookup ([txtTypeOfArea]) " & _
               "VALUES ('" & Me.txtAddTypeOfArea & "');"

Number
strSQLInsert = "INSERT INTO tblAreaTypeLookup ([txtTypeOfArea]) " & _
               "VALUES (" & Me.txtAddTypeOfArea & ");"

Date:
strSQLInsert = "INSERT INTO tblAreaTypeLookup ([txtTypeOfArea]) " & _
               "VALUES (#" & Me.txtAddTypeOfArea & "#);"
[\code]
Wayne
 
Excellent! Thanks for that, something so simple, and bleeding obvious!

Cheers (again!)
 

Users who are viewing this thread

Back
Top Bottom