I have used the following code in other apps successfully. It is not working in the present app. I don't know why. Are there any suggestions?
The debugger stops at the line:
Set rs = db.OpenRecordset(sql, dbOpenSnapshot)
Help!
Code:
Private Sub Form_Current()
Dim db As Database 'declare a variable that points to the database
Dim rs As DAO.Recordset 'declare a variable that will hold your recordset
Dim sql As String 'declare a variable that will hold your sql string
'set the db variable equal to the currentDB
Set db = CurrentDb
'Check to make sure PRClaimNo is not = 0 if it is then it means that
'the person is trying to enter a new record that has no Client
If (Me.PRClaimNo = 0) Then
MsgBox "Please select a client"
Else
'set the sqlString to contain all of the other values you want on
'your form. In this case...first and last
sql = "select PatientFName, PatientMName, PatientLName From tblInitialEval"
sql = sql & " Where tblInitialEval.IEClaimNo = " & Me.PRClaimNo
'set the rs to the sql query ...basically
[COLOR=red]Set rs = db.OpenRecordset(sql, dbOpenSnapshot)[/color]
'now you can set the values of the text boxes with their appropriate
'values in the query
Me.PatientName = rs.Fields("PatientFName")
End If
End Sub
The debugger stops at the line:
Set rs = db.OpenRecordset(sql, dbOpenSnapshot)
Help!