Strange behaviour in Code

  • Thread starter Thread starter lalexander
  • Start date Start date
L

lalexander

Could someone please assist with this problem.
I had this program working fine and I must have changed something because
whenever I run this
I get "Variable not defined" - it's pointing at the - dbOpenDynaset

I tried to trace if the value of cbologinname was being passed - it is .

Please help as I'm pulling my hair out.


========================================================
' Create an updateable recordset for the selected UserID from the combo
box.
'
SQL = "SELECT LOGIN_NAME,FULLNAME,PSWD,ID,UPDTE,PRIOLEVEL FROM ANNFILE "
SQL = SQL & " WHERE IDNO =" & cboLoginName & ";"

Set rs = CurrentDb.OpenRecordset(SQL, dbOpenDynaset)

============================================================
 
Suggestions.

1. What is the data type of the bound column of cboLoginName?
If it is Text (not Number), you need extra quotes, i.e.:
SQL = SQL & " WHERE IDNO = """ & cboLoginName & """;"

2. Above the code, declare rs as a DAO recordset. The ADO library also has a
Recordset object, but that won't work with your code. The line will be:
Dim rs As DAO.Recordset
If that line fails, check your references as described in this article:
http://members.iinet.net.au/~allenbrowne/ser-38.html
 
Allen,
Thanks for the tip.

Somehow the Reference Library did not have a check on the - DA0360.DLL

( I'ts been some time I did not use this program . I had formated my
machine a year ago, which lead me
to believe I probably had the reference in there in the early days. )

Regards.
 
Back
Top