Missing check mark

B

BethMc

Hello - I have a check box that triggers an Event Procedure to save the
record and close the form, report, database and Access itself. The Procedure
is working perfectly now (thank you for help received here!) but the check
mark is not recording when the box is clicked. It doesn't show either in the
source table, or on the printed report. It DID show, back when the Procedure
didn't work.
Any suggestions on what I could have done to stop the check mark from
recording? (I've tried to put Properties back where they were after
experimenting, but I could easily have missed one - or two - or... )
All suggestions gratefully received - Thank you in advance.
 
F

fredg

Hello - I have a check box that triggers an Event Procedure to save the
record and close the form, report, database and Access itself. The Procedure
is working perfectly now (thank you for help received here!) but the check
mark is not recording when the box is clicked. It doesn't show either in the
source table, or on the printed report. It DID show, back when the Procedure
didn't work.
Any suggestions on what I could have done to stop the check mark from
recording? (I've tried to put Properties back where they were after
experimenting, but I could easily have missed one - or two - or... )
All suggestions gratefully received - Thank you in advance.

I would suspect that the check control is NOT BOUND to a table field.
Check the control source. If you wish it to show up in your table or
on your report, it should not be empty.
 
B

Beetle

Is the checkbox also meant to record some other logical data that is
part of the record, or is it just used to save the record and close the app?

If the former, check the control source of the check box. If the latter, then
I see no reason to have it's value saved.
 
B

BethMc

Yes, the checkbox records that the rental customer did mark the box labeled
"I agree to all the above terms and conditions" - I do need it to show. And,
the Control Source is still set to the field (field name: I Agree), which
recorded check marks just fine until two days ago.

Here's my Event Procedure - the idea is that the rental contract doesn't
print until the customer confirms agreement to all terms.

Private Sub Check126_Click()

DoCmd.RunCommand acCmdSaveRecord
' Print current record
DoCmd.OpenReport "Jeep Rental Agreement Report", acViewNormal, "",
"[Guest ID]=[Forms]![Jeep Rental Agreement 2]![Guest ID]", acDialog
' Close report
DoCmd.Close acReport, "Jeep Rental Agreement Report"
' Save record and close form
DoCmd.Close acForm, "Jeep Rental Agreement 2"
DoCmd.Quit

End Sub

Do you see anything here that could be preventing the check mark from
recording? Thank you very much for taking a look -
 
B

BethMc

Please see the reply to Beetle, above - the control is bound to its field,
and I do need it to print.

Sudden thought - since I ended up using an Event Procedure (VBA) rather than
a macro, could the fact that the Source field has a space in it be causing a
problem? I saw somewhere that VBA doesn't like spaces.

Thank you for anything you can tell me.
 
B

Beetle

hmmmmm. Nothing stands out as to why the check box value would not be
saved. If you make changes to other fields in the record, are those
changes saved?

The only thing that looks odd in your code is the criteria string for the
report. normally it would be;

"[Guest ID]=" & [Forms]![Jeep Rental Agreement 2]![Guest ID]

instead of the whole line being within the quotes as you have it, but
that's got nothing to do with the record being saved or not.

Fred is more knowledgeable than I am, so maybe he will see something
I'm missing.

--
_________

Sean Bailey


BethMc said:
Yes, the checkbox records that the rental customer did mark the box labeled
"I agree to all the above terms and conditions" - I do need it to show. And,
the Control Source is still set to the field (field name: I Agree), which
recorded check marks just fine until two days ago.

Here's my Event Procedure - the idea is that the rental contract doesn't
print until the customer confirms agreement to all terms.

Private Sub Check126_Click()

DoCmd.RunCommand acCmdSaveRecord
' Print current record
DoCmd.OpenReport "Jeep Rental Agreement Report", acViewNormal, "",
"[Guest ID]=[Forms]![Jeep Rental Agreement 2]![Guest ID]", acDialog
' Close report
DoCmd.Close acReport, "Jeep Rental Agreement Report"
' Save record and close form
DoCmd.Close acForm, "Jeep Rental Agreement 2"
DoCmd.Quit

End Sub

Do you see anything here that could be preventing the check mark from
recording? Thank you very much for taking a look -
--
Beth McCalley


Beetle said:
Is the checkbox also meant to record some other logical data that is
part of the record, or is it just used to save the record and close the app?

If the former, check the control source of the check box. If the latter, then
I see no reason to have it's value saved.
 
P

Peter Hibbs

Beth,

I tried out your code and it works (sort of). The DoCmd command
errored out due the the acDialog parameter at the end (which is not
required) and, as Beetle pointed out, the criteria format is
incorrect. Also you don't need the second and third parameters
(although it would not give you the problem you are having) as these
are the default values.

The only other problem I see is that if the user should click on a
CheckBox that is already checked, the report will still be printed but
with the box unchecked. Perhaps you could try something like this -

Private Sub Check126_Click()

DoCmd.RunCommand acCmdSaveRecord
If Check126 = True Then
' Print current record
DoCmd.OpenReport "Jeep Rental Agreement Report", , ,
"[Guest ID]= " & [Forms]![Jeep Rental Agreement 2]![Guest ID]
' Close report
DoCmd.Close acReport, "Jeep Rental Agreement Report"
' Save record and close form
DoCmd.Close acForm, "Jeep Rental Agreement 2"
DoCmd.Quit
EndIf

End Sub

Note that the DoCmd line and the criteria part is all on the same
line.

Personally I think you would be better using a button control to print
the report and only print the report if the check box is ticked, it
would give more control over what happens.

HTH

Peter Hibbs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top