I have this script below which is supposed to open on form if "[solid_waste?]" is true and another if false. Both forms might not have a record in the required table yet and I need to be able to put the Manifest_ID into each if that is the case. Access is saying their is a data type mismatch but won't show me where so I need some help.
Thanks
Private Sub Command24_Click()
On Error GoTo Err_Command24_Click
Dim stForm As String
Dim stDocName As String
Dim stTable As String
Dim stID As String
Dim stLinkCriteria As String
Dim intCounter As Integer
If Me.[solid_waste?] = True Then
stForm = "frm_RCRA" And stTable = "tbl_RCRA" And stID = "RCRA_ID"
Else
stForm = "frm_DOT" And stTable = "tbl_DOT" And stID = "DOT_ID"
End If
intCounter = IIf(IsNull(DCount("[stID]", "stTable", "[manifest_id]=" & Me.Manifest_ID)), 0, DCount("[stID]", "stTable", "[manifest_id]=" & Me.Manifest_ID))
Select Case intCounter
Case Is = 0
DoCmd.OpenForm "stForm", , , , acFormAdd
Forms!stForm!Manifest_ID = Me.Manifest_ID
Case Is >= 1
stDocName = "stForm"
stLinkCriteria = "[manifest_id]=" & Me![manfiest_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Select
Exit_Command24_Click:
Exit Sub
Err_Command24_Click:
MsgBox Err.Description
Resume Exit_Command24_Click
End Sub