G
Guest
IHow do I open a sub form on my main form, frmDiscipline, using code. I
really tried to do it myself and came up with this.
Dim lngFormNumber As Long
Dim strFormName As String
'The lstbox is called lstViolationSelect and the field that is holding
information is ViolationID THIS IS WHERE I AM GETTING THE ERROR
lngFormNumber = Me![ViolationID]
Set db = CurrentDb
Set rst = db.OpenRecordset("Select FormName FROM tblFormList WHERE
FormNumber = lngFormNumber")
strFormName = rst.Fields("FormName")
rst.Close
DoCmd.OpenForm strFormName, , , , acFormAdd
really tried to do it myself and came up with this.
Dim lngFormNumber As Long
Dim strFormName As String
'The lstbox is called lstViolationSelect and the field that is holding
information is ViolationID THIS IS WHERE I AM GETTING THE ERROR
lngFormNumber = Me![ViolationID]
Set db = CurrentDb
Set rst = db.OpenRecordset("Select FormName FROM tblFormList WHERE
FormNumber = lngFormNumber")
strFormName = rst.Fields("FormName")
rst.Close
DoCmd.OpenForm strFormName, , , , acFormAdd