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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.RunSQL

Status
Not open for further replies.

muppet123

Technical User
May 11, 2005
19
GB
Hi All,
Any idea why the following doesn't work? it takes the contents of an unbound txt box and 'should' place it into the address5 field.

Any help greatly appreciated.

Private Sub countryabb_AfterUpdate()
Dim strText As String
strText = Me.countryabb
DoCmd.RunSQL "INSERT INTO Tbl_CusDetails (Address5) '" & strText & "';"
End Sub

cheers
Mup'

 
doesn't work?
What happens ? Any error message ? Unexpected behaviour ?
You really want to create a record in Tbl_CusDetails with only Address5 having a value ?
Anyway, the correct syntax is:
DoCmd.RunSQL "INSERT INTO Tbl_CusDetails (Address5) VALUES ('" & strText & "')"


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, I think I had the INSERT/CREATE mis-understood.

many thanks
Mup'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top