NewTexican
Technical User
I have a pop up that relates to a parent form and changes as user scrolls through parent form. I'm getting "Runtime error 13 type mismatch" when I scroll to an empty record on the parent form. Debug takes me to either the highlighted line or the code on a subform that points to this sub.
Public Sub updatecontrols()
Dim db As Database
Dim rstable As DAO.Recordset
Dim sqllst1, sqllst2 As String
Dim mail1, mail2 As Boolean
Dim compnum As Variant
Dim addtype As Variant
Dim compname As Variant
compnum = Me.Text18
addtype = Me.Text20
compname = Forms![common company].[company name]
[highlight] Me!Label45.Caption = compname [/highlight]
Me!Label46.Caption = addtype & " Address Mailouts"
Set db = CurrentDb
Set rstable = db.OpenRecordset("Company-Mailout T", dbOpenDynaset)
sqllst1 = "[company numeric] = " & compnum & " and [address type] = " & "'" & addtype & "'" & " and [mailout] = 'c mailout 1'"
sqllst2 = "[company numeric] = " & compnum & " and [address type] = " & "'" & addtype & "'" & " and [mailout] = 'c mailout 2'"
rstable.FindFirst sqllst1
Me!Check12.Value = (Not rstable.NoMatch) And rstable![Send mailout]
rstable.FindFirst sqllst2
Me!Check14.Value = (Not rstable.NoMatch) And rstable![Send mailout]
rstable.Close
End Sub
I thought maybe changing my variables to type variant would solve this, but it doesn't. Thanks.
Public Sub updatecontrols()
Dim db As Database
Dim rstable As DAO.Recordset
Dim sqllst1, sqllst2 As String
Dim mail1, mail2 As Boolean
Dim compnum As Variant
Dim addtype As Variant
Dim compname As Variant
compnum = Me.Text18
addtype = Me.Text20
compname = Forms![common company].[company name]
[highlight] Me!Label45.Caption = compname [/highlight]
Me!Label46.Caption = addtype & " Address Mailouts"
Set db = CurrentDb
Set rstable = db.OpenRecordset("Company-Mailout T", dbOpenDynaset)
sqllst1 = "[company numeric] = " & compnum & " and [address type] = " & "'" & addtype & "'" & " and [mailout] = 'c mailout 1'"
sqllst2 = "[company numeric] = " & compnum & " and [address type] = " & "'" & addtype & "'" & " and [mailout] = 'c mailout 2'"
rstable.FindFirst sqllst1
Me!Check12.Value = (Not rstable.NoMatch) And rstable![Send mailout]
rstable.FindFirst sqllst2
Me!Check14.Value = (Not rstable.NoMatch) And rstable![Send mailout]
rstable.Close
End Sub
I thought maybe changing my variables to type variant would solve this, but it doesn't. Thanks.