Check Box Support

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a check box on a form that when checked opens another form and copies
data to the newly opened form. Once the new form has been opened and data
added I would like the check box on the main form to be removed. However if a
user click on the check box I would like it to open the associated form and
the data originally created.

What is happening know is the check box is being toggled off and on. Users
don't know if there is data in the sub form or not. If they click on the
check box it tries create a second record. However I have the table of this
form set to not allow more then one record based on the link ID.

Any help would be greatly appreciated.

Matt
 
Matt,

In the checkbox's Click or AfterUpdate event, you need to check if the
record exists, and if so, open the form, and if not, append the record.

Private Sub chkMyCheckBox_Click()
If (Me.chkMyCheckBox = True) Then
If Not IsNull(DLookup("fieldname", "tablename", "somecriteria") Then
DoCmd.OpenForm "formname", , , "somecriteria"
Else
'Add code to append the new record
End If

Me.chkMyCheckBox = False
End If
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top