I have a form (frmvslsearch). On this form I have a combobox (cbovslnumber). This combobox is linked to a table (tblvessels). In the combobox I can select from the field called 'Vessel number'. When I have selected, another form is activated (frmvslinformation). The textboxes on this form are linked to different fields in the table. The problem is then the checkbox (also on form2 (frmvslinformation). The field to be used in the table is called 'Ongoing'. I have used a 'Yes/No' field (not sure if this is ok!). If the field is marked in the table (Yes/True) then the checkbox should also be marked on 'frmvslinformation', and if it is unmarked in the table, then the same on the form.
Below code is what I have re this:
Private Sub cboVslnumber_AfterUpdate()
Forms("frmvslsearch").Visible = False
DoCmd.OpenForm "frmvslinformation"
'Check the value of the True/False field of the record.
Dim myVal
myVal = DLookup("Vessel number", "tblVessels", "Ongoing = " & "'" & Me.cboVslnumber & "'")
'Assign the value to the checkbox
If Not IsNull(myVal) Then
Me.chkOngoing = CInt(myVal)
End If
End Sub
My problem is that I can't get the checkbox part to work.
I would appreciate any help given.
Thanks.
Below code is what I have re this:
Private Sub cboVslnumber_AfterUpdate()
Forms("frmvslsearch").Visible = False
DoCmd.OpenForm "frmvslinformation"
'Check the value of the True/False field of the record.
Dim myVal
myVal = DLookup("Vessel number", "tblVessels", "Ongoing = " & "'" & Me.cboVslnumber & "'")
'Assign the value to the checkbox
If Not IsNull(myVal) Then
Me.chkOngoing = CInt(myVal)
End If
End Sub
My problem is that I can't get the checkbox part to work.
I would appreciate any help given.
Thanks.