Hi,
I'm trying to use 2 criterias for this dcount function but I get "type mismatch" error. What I want to do here is, if the model (from model and to model) is not existing, activate a new form). Any help will be appreciated. Other alternative methods are welcome as well.
Thank you.
Private Sub REF_Enter()
Dim OUTx As Integer
Dim INy As Integer
OUTx = DCount("*", "STDCONVOUT", "[FROMMODEL]='" & Me.[FROMMODEL] & "'" And "[TOMODEL]='" & Me.[REQUESTMODEL] & "'")
INy = DCount("*", "STDCONVIN", "[STDCONVIN]![FROMMODEL]='" & Me.[FROMMODEL] & "'" And "[STDCONVIN]![TOMODEL]='" & Me.[REQUESTMODEL] & "'")
'OUTx = DCount("[PARTNUM]", "STDCONVOUT", "[STDCONVOUT]![FROMMODEL]='" & Me.[FROMMODEL] & "'")
If (OUTx = 0) And (INy = 0) Then
If MsgBox("This is a new model. Add this model?", vbOKCancel, "Error!") = vbOK Then
DoCmd.OpenForm "AddConvModel", acNormal
End If
End If
End Sub
I'm trying to use 2 criterias for this dcount function but I get "type mismatch" error. What I want to do here is, if the model (from model and to model) is not existing, activate a new form). Any help will be appreciated. Other alternative methods are welcome as well.
Thank you.
Private Sub REF_Enter()
Dim OUTx As Integer
Dim INy As Integer
OUTx = DCount("*", "STDCONVOUT", "[FROMMODEL]='" & Me.[FROMMODEL] & "'" And "[TOMODEL]='" & Me.[REQUESTMODEL] & "'")
INy = DCount("*", "STDCONVIN", "[STDCONVIN]![FROMMODEL]='" & Me.[FROMMODEL] & "'" And "[STDCONVIN]![TOMODEL]='" & Me.[REQUESTMODEL] & "'")
'OUTx = DCount("[PARTNUM]", "STDCONVOUT", "[STDCONVOUT]![FROMMODEL]='" & Me.[FROMMODEL] & "'")
If (OUTx = 0) And (INy = 0) Then
If MsgBox("This is a new model. Add this model?", vbOKCancel, "Error!") = vbOK Then
DoCmd.OpenForm "AddConvModel", acNormal
End If
End If
End Sub