Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

access vba on error

Posted on 2013-01-31
2
Medium Priority
?
274 Views
Last Modified: 2013-02-06
I have this
I need it to do nothing if the isloaded fails at present it gives an error message and I dont want that.

 If Forms!frmexportvincode.Form.Controls.Item("BtnToggleSyncForms").Value And CurrentProject.AllForms("FrmSMMTMaster").IsLoaded = True Then
 
 
                        Forms!frmexportvincode.Form.Controls.Item("TxtExportMvrisFromSMMT").Value = Me.MVRIS_CODE.Value

                    End If

Open in new window

0
Comment
Question by:PeterBaileyUk
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 1000 total points
ID: 38843062
I don't see how you can be getting an error from this bit of code.
If isloaded is false it already does nothing.

Is there more code that follows this?
If so, and you want to prevent that code from running then you can do

If Forms!frmexportvincode.Form.Controls.Item("BtnToggleSyncForms").Value And CurrentProject.AllForms("FrmSMMTMaster").IsLoaded = True Then
 
     Forms!frmexportvincode.Form.Controls.Item("TxtExportMvrisFromSMMT").Value = Me.MVRIS_CODE.Value
else
     exit sub  '(or exit function, whatever this code is in)
End If

Note that this will also cause an exit if FrmSMMTMaster IS loaded but BtnToggleSyncForms is false.
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 1000 total points
ID: 38857408
Yes, issue like this are sometimes more or less meaningless without any context...

But first try Pete's suggestions, then post a sample database :

Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Remove any records unless they are relevant to the issue.
5. Delete any objects that do not relate directly to the issue.
6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
9. Unhide any hidden database objects
10. Compile the code. (From the VBA code window, click: Debug-->Compile)
11. Run the compact/Repair utility.
12. Remove any Passwords and/or security.
13. If a form is involved in the issue, set the Modal and Popup properties to: No
    (Again, unless these properties are associated with the issue)
14. Post the explicit steps to replicate the issue.
15. Test the database before posting.

In other words, ...post a database that we can easily open and immediately see and/or troubleshoot the issue.
And if applicable, also include a clear graphical representation of the *Exact* results you are expecting, based on the sample data.

JeffCoachman
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question