Hello,
I made a form with a field and I set a GotFocus function for it:
If I don`t write the line Dim SQL As String I get the error "Variabile not defined". What is strange here is that, in another application, the same function works. In the code above another error occured "Compile error: Variabile not defined", and the error referes to the last line of the code:
Set r = CurrentDb.OpenRecordset(SQL, dbOpenSnapshot)
and says that the variable dbOpenSnapshot is not defined. What`s wrong? Why I get these errors? How can I avoid them? I repeat that the same code works in another application.
Thank you in advance!
I made a form with a field and I set a GotFocus function for it:
Code:
Private Sub NRCDA_GotFocus()
Dim SQL As String
' i build the qry
SQL = "SELECT * FROM NRCRT"
' recordset variable
Dim r As Recordset
' open the recordset
Set r = CurrentDb.OpenRecordset(SQL, dbOpenSnapshot)
End Sub
If I don`t write the line Dim SQL As String I get the error "Variabile not defined". What is strange here is that, in another application, the same function works. In the code above another error occured "Compile error: Variabile not defined", and the error referes to the last line of the code:
Set r = CurrentDb.OpenRecordset(SQL, dbOpenSnapshot)
and says that the variable dbOpenSnapshot is not defined. What`s wrong? Why I get these errors? How can I avoid them? I repeat that the same code works in another application.
Thank you in advance!
Last edited: