Solved

access vba on error

Posted on 2013-01-31
2
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 250 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 250 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

635 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