?
Solved

OpenArgs causing a problem

Posted on 2010-01-11
11
Medium Priority
?
380 Views
Last Modified: 2013-11-28
In the code listed below, I am passing the arguments from one form to another and then using OpenArgs to find the appropriate record on a newly opened form.

The problem I am experiencing with this is when the form is opened, in the status bar it says "Calculating..." and it sits like that for about a minute. I can see the subform flickering while this is going on.

It finds the right record and all, but I can't figure out what is it trying to Calculate???????
Private Sub cmdPaymentTransactionsContainer_Click()
    
DoCmd.OpenForm "frmPaymentTransactionsContainer", acNormal, , , , acDialog, Me!     [frmMembershipClientTransactions].Form.[Client Membership ID]

End sub

--------------------------------

Private Sub Form_Load()
        'Read arguments passed from the previous form and find corresponding record
        Me.Form.Recordset.FindFirst "[Client Membership ID] = " & Me.OpenArgs
End Sub

Open in new window

0
Comment
Question by:dpokerbear
[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
  • 5
  • 5
11 Comments
 
LVL 39

Expert Comment

by:thenelson
ID: 26289984
Try:
Me.Recordset.FindFirst "[Client Membership ID] = " & Me.OpenArgs
0
 
LVL 39

Expert Comment

by:thenelson
ID: 26289987
BTW:
It is best to avoid spaces, underscores and other special characters in your naming of objects. For example: CountOfPeopleLive is just as easy to read as Count Of People_Live.  Objects named with special characters including spaces need to be placed in brackets for access to recognize them correctly. Here is an extreme example of the problems you will have using special characters in your names:
I named a textbox
!@#$%^&*()_+= -{}:;"'<,>?/|~
And had access create an event procedure.  Access converted the name of the textbox to:
Ctl_____________________________
so if the form had the name:
~!@#$%^&*()_+= -{}:;"'<,>?/|~
Referencing the textbox would be:
Forms!L_____________________________!Ctl_____________________________
a useful tip for someone who doesn't want someone else (probably even themselves) from reading their code.
And spaces will sometimes cause problems in vba references even after years of trouble free operation.

It is also a good idea to use a naming scheme such as leszynski naming conventions (see references). It makes it clearer what type of object you are naming and it reduces the risk of duplicate name problems (like a control name and its control source).

References:
Http://Www.Xoc.Net/standards/rvbanc.Asp
http://Www.Dhdurso.Org/articles/ms-access-naming.Html
http://Www.Acc-technology.Com/namconv.Htm
http://Www.Databasedev.Co.Uk/naming_conv.Html
http://En.Wikipedia.Org/wiki/leszynski_naming_convention
0
 

Author Comment

by:dpokerbear
ID: 26290035
After doing some more testing, I found something even more disturbing than the problem I quoted initially.

I took everything out of form load and this is the only line I have in it.

MsgBox Nz(Me.OpenArgs, 0)

What happens is a problem with a form focus. The "Calculating..." message in the status bar stays on the form and the whole form is flashing until I start moving the mouse. Then it gets the focus and is fine.

If I take the OpenArgs line (mentioned above) out of the Load Form, then this problem doesn't happen.

It seems to be a form focus problem but only when OpenArgs is used in Form Load OR Open Form Sub.

Why is this happening?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 39

Accepted Solution

by:
thenelson earned 1500 total points
ID: 26290047
It could be a corrupted database or form.  Going past step 7 will probably not help for this problem. I include the additional steps for your future reference.

Steps (approximately in order) to use to fix a corrupted Access database. (Test after each step.)

1) CREATE A BACKUP OF THE CORRUPT DATABASE. (Just in case)

2) Compact and repair

3) Use jetcomp.exe  http://support.microsoft.com/default.aspx?scid=kb;en-us;Q273956

4) decompile: in run: msaccess "dbPathName.mdb" /decompile
   Compact/repair:  in run: msaccess "dbPathName.mdb" /compact
   compile: in VB editor: debug> compile
   Compact/repair
   http://www.granite.ab.ca/access/decompile.htm

5) Use a backup (you have a lot of those -- yes?)

6) If you can identify one or a few forms or reports causing problems, copy the problem form/report from a backup.  Or create a new form/report and copy all the objects in the old form/report to the new one. Copy the code from the old form/report using the undocumented
    Application.SaveAsText acForm, FormName, "C:\" & FormName & ".txt"
then paste that from Notepad into the new form/report.  If a module, copy the code using SaveAsText, create a new module, paste the code into the new module.


7) Create a new database, use File> Get external data> Import to get all objects of the damaged database and set up the options again.

8) Try a recovery tool:
   www.officerecovery.com/access/index.htm
   www.mvps.org/access/tables/tbl0018.htm

9) Hire a company to repair the database  http://www.pksolutions.com/services.htm

Additional information:
How to Troubleshoot/Repair Damaged Jet 3.0 and Prior Databases
http://support.microsoft.com/support/kb/articles/Q109/9/53.asp

How to Troubleshoot Corruption in a Microsoft Access Database
http://support.microsoft.com/default.aspx?scid=kb;en-us;306204

Corrupt Microsoft Access MDBs FAQ
http://www.granite.ab.ca/access/corruptmdbs.htm
0
 

Author Comment

by:dpokerbear
ID: 26290226
Hi Nelson,

I found what the problem is. I didn't have to use any of the steps you recommended, thanks for your advice though anyway.

This, I think is a major Microsoft Bug in Access and unfortunately, it's nothing to do with the problem I posted originally.

If you have a form which calls another form and mouse cursor happens to be in an un-populated area of a datasheet, you'll get a message Calculating... in the status bar and you may notice some values are continuosly refresing as if something is thrashing away in the background. Some loose code or while loop or god knows what...

If you move the mouse out of the un-populated area of the datasheet, it stops.

Try it and see. Let me know if you can get it to happen.
0
 

Author Comment

by:dpokerbear
ID: 26290267
Further to my comment earlier, this only happens on a datasheet with Conditional Formatting.
0
 
LVL 39

Expert Comment

by:thenelson
ID: 26290269
No, I don't get the problem (A 2003).  Try creating a new database and see if it happens there.
0
 
LVL 85
ID: 26292876
Neither do I, therefore it is most certainly not a bug. As Nelson said, you obviously have corruption in your form (or in your database).
0
 

Author Comment

by:dpokerbear
ID: 26299940
Hi guys,

I created a dummy database and tested it. You are right, it doesn't happen all the time. I took the conditional formatting out of the form that was causing me the problem and that fixed the problem.

Therefore, it must have been something to do with conditional formatting. Later on, I'll try to put it in again, but for now I am happy to let this one rest.

Thanks again for your help. Will keep you posted if it happens again.

Nelson, I am happy to award you the points for that info on backup and repair. That is useful info. Thanks.
0
 

Author Closing Comment

by:dpokerbear
ID: 31675914
Thanks for the info.
0
 
LVL 39

Expert Comment

by:thenelson
ID: 26300492
| would at least try the decompile (step 4) to see if that fixes the problem.

You're welcome.  Glad to help and thank you very much for the points with "A" grade!

Happy computing!

Nelson
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 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