In the Before Update event of the checkbox blnToBeBilled:
Private Sub blnToBeBilled_BeforeUpdate(Cancel As Integer)
Dim strMsg as String, strTitle as String
strMsg = "Are you sure you want to cancel this booking?"
strTitle = "Cancel Booking?"
If Me.blnToBeBilled = True Then
If MsgBox (strMsg, vbYesNo, strTitle) = vbYes Then
DoCmd.OpenForm "frmCancel", WindowMode:=acDialog
Else
Cancel = True
End If
End If
End Sub
I'm not sure if "don't really code" means "don't code at all", so here is the
basic procedure. It sounds as if the check box blnToBeBilled is selected to
cancel the booking, so I am proceeding on that assumption. If not, the
following still applies, but for the check box used to cancel the booking.
To add the check box Before Update code, open the form in Design View, click
the check box to select it, then click View >> Properties. The box that
appears (if it isn't already showing) is the Property Sheet. Click the Event
tab, click Before Update, and click the three dots on the right side.
Depending on your settings, the VBA editor may open. Otherwise, you should
be presented with some choices. If so, choose Code Builder, and click OK.
In either case the VBA editor should open, with the lines:
Private Sub blnToBeBilled_BeforeUpdate(Cancel As Integer)
End Sub
The cursor should be blinking between those lines. Add the code there. When
you are done, click Debug >> Compile from the menu at the top of the window.
Repeat for the code on the command button on the form that opens to add the
reason for cancelling. It should look something like this:
Priavate Sub cmdClose_Click()
DoCmd.Close acForm, Me.Name
End Sub
Now, about the pop-up form. Presumably the reason for cancelling will be
part of the record, so you would need to bind the pop-up form to the same
table as the main form. After the reason is added, you need to make
provisions to view the reason, either by clicking a button to display the
information, or by using a text box on the main form. You may want to
consider displaying a text box (txtCancelReason) on the form rather than
opening another form:
Private Sub blnToBeBilled_BeforeUpdate(Cancel As Integer)
Dim strMsg as String, strTitle as String
strMsg = "Are you sure you want to cancel this booking?"
strTitle = "Cancel Booking?"
If Me.blnToBeBilled = True Then
If MsgBox (strMsg, vbYesNo, strTitle) = vbYes Then
Me.txtCancelReason.Visible = True
Me.txtCancelReason.SetFocus
Else
Cancel = True
End If
End If
End Sub
If you use this approach, you can add scroll bars to txtCancelReason in case
there is a lot of text (use the Property Sheet to do this). To display the
text box for each record in which blnToBeBilled is True, in the form's
Current event:
Me.txtCancelReason.Visible = Me.blnToBeBilled
It sounds as if you may benefit from some instruction in how Access works.
The following links can help with that. IMHO Crystal's tutorial is as good a
place as any to start:
Jeff Conrad's resources page:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html
The Access Web resources page:
http://www.mvps.org/access/resources/index.html
Roger Carlson's tutorials, samples and tips:
http://www.rogersaccesslibrary.com/
A free tutorial written by Crystal:
http://allenbrowne.com/casu-22.html
A video how-to series by Crystal:
http://www.YouTube.com/user/LearnAccessByCrystal
MVP Allen Browne's tutorials:
http://allenbrowne.com/links.html#Tutorials