vba

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Vba

Vba

resolvedResolved · Medium Priority · Version 2003

Joanne has attended:
Access VBA course

Vba

Hi I a code to print out a report sheet but I needed the code to check that the results are correct first and if not then tell the user to select a different check box. Well the code does that as far as tell the user to select the correct box but when you select the correct box the code does not do enthing? Can some one help please.
'------------------------------------------------------------
' PRINT_REPORT
'
'------------------------------------------------------------
Function PRINT_REPORT()
On Error GoTo PRINT_REPORT_Err

With CodeContextObject
If (.CheckChoice = 1 And .RingAppr = "Not Approved") Then
Beep
MsgBox "1st Off Not Approved please select SETTING tick box", vbExclamation, "NOT APPROVED"
End If
Exit Function
DoCmd.Close acForm, "ENTER DATA"
DoCmd.OpenReport "Inner Ring Result page", acViewPreview, "", "", acNormal
DoCmd.PrintOut acPages, 1, 1, acHigh, 1, True
DoCmd.Close acReport, "Inner Ring Result page"
DoCmd.OpenForm "Switchboard", acNormal, "", "", , acNormal
End With


PRINT_REPORT_Exit:
Exit Function

PRINT_REPORT_Err:
MsgBox Error$
Resume PRINT_REPORT_Exit

End Function

RE: vba

Hi Joanne

A first glance shows that your exit function command is outside of the block IF. Therefore it runs regardless of the selection.
Place it inside the block iif and see if this solves the problem

Any further problems please get back to me

Regards

Stephen

Tue 12 Jan 2010: Automatically marked as resolved.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Undo Entries In Records

To Undo any entries or changes in records:

Hit the ESC key once for the current field

And ESC twice for current record

View all Access hints and tips


Server loaded in 0.08 secs.