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

adodb recordset problem 1

Status
Not open for further replies.

gagirl43

Programmer
Nov 3, 2004
8
US
I've converted an Access 97 database to 2000 and am trying to update the Visual Basic 6 program to access the database. I originally changed the database and recordsets to DAO. The program compiled and ran fine in the development environment; but when I created the .EXE, I got the error "The memory could not be written" when I tried to run it. Debug showed this as an access violation. I didn't know what to do about this so I went back to the drawing board and changed DAO to ADODB. Depending on how I set the code up, I either get a message about a syntax error in the FROM clause or object variable not set. This is what I have right now and it produces the syntax error:

Public conn As ADODB.Connection
Public rstLoad As ADODB.Recordset
Public strSQL As String
Public LoginID As String

Set conn = New ADODB.Connection
set rstLoad = New ADODB.Recordset

conn.Open "provider=Microsoft.Jet.OLEDB.4.0;" & _
"data source=c:\variance.mdb;"

LoginID = "tmprray"
strSQL = "Select * From User Where LoginID = '" & LoginID & "'"
rstLoad.Open strSQL, conn

The last statement is where the error occurs. I'm really frustrated and would appreciate any help.

Thanks,
Rhonda

 
I think the problem is use of the reserved word "user"

try:

strSQL = "Select * From [User] Where LoginID = '" & LoginID & "'"

Andy
--
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top