I recently changed my code from Dlookup to opening a recordset. This is my first time using a record set and having issues opening the form now. When I click to open the form nothing happens. No errors and it doesn't load
Here is the opening code
Thanks for your help,
Vasago
Here is the opening code
Code:
Private Sub Form_Load() Dim db As DAO.Database Dim rst As DAO.Recordset Dim strRst As String Dim strCriteria As String strCriteria = "Employee='" & Forms![Royal time Stamp]![Driver] & "' And [Date]=#" & Date & "# And [Trip Sign Off]=0" Set db = CurrentDb strRst = "SELECT [Punch ID] " & _ "FROM [Copy of Employee Work Statistics1] " & strCriteria Set rst = db.OpenRecordset(strRst, dbOpenDynaset) [Punch ID] = rst![Punch ID] [Type of Work] = rst![Type of Work] If [Type of Work] = "" Then Else Me.[Type of Work].Locked = True [Trip_S_on] = rst![Trip Sign On] If [Type of Work] = "Transportation Specialist" Then Me.[bus number].Visible = True [bus number] = rst![bus number] Me.[bus number].Locked = True Me.Route.Visible = True [Route] = rst![Route] Me.Route.Locked = True Else Me.Route.Locked = False Me.School.Locked = False Me.[bus number].Locked = False End If If [Route] = "field Trip" Then Me.[School].Visible = True [School] = rst!School Me.School.Locked = True Else Me.School.Locked = False End If End If 'At the end of your code, close what you open 'and release what you set rst.Close Set db = Nothing Set rst = Nothing End Sub
Vasago
Comment