|
-
August 29th, 2000, 09:53 AM
#1
Syntax Error in INSERT INTO statement
I am just learning VB. I have a very simple Database that I am trying to access. I'm getting an error in the INSERT INTO statement. I am using sample code to put together what I need to do. The sample this came from is identical(I think) except for the tables and field names and it works. Here is my code:
''Connecting to the database
''
Dim stSQL as string
Dim Pass as string
Dim Comm as string
Dim stClientNumber as string
set objAccessConnection = new ADODB.Connection
objAccessConnection.CursorLocation = adUseClient
objAccessConnection.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
" Data Source=c:\host\custlist.mdb"
sSQL = "SELECT ClientNumber, Password, CommPass FROM Cust"
set rsAccess = new ADODB.Recordset
rsAccess.Open sSQL, objAccessConnection, adOpenKeyset, adLockOptimistic
''Insert statement
''
With frmAdd
Pass = .txtAddPassword
Comm = .txtAddComm
stClientNumber = .txtAddClient
stSQL = "INSERT INTO Cust(ClientNumber,Password,CommPass) VALUES "& _
"(stClientNumber,Pass,Comm)"
objAccessConnection.Execute stSQL
Any ideas as to why it won't work? Thanks
Catrina
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|