Thread: Not reading code on form load
11-29-10, 08:00 #1Registered User
- Join Date
- May 2003
Unanswered: Not reading code on form load
The code is not being read on a form load event at runtime yet will when I step into the code.
I am importing contact details into a table. This data is checked to make sure it meets certain criteria. For example it checks to see that an organisation exist that relates to the contact being imported. If no organisation exists it open a form displaying those no existent organisation and stop their so the contacts cannot be imported until the organisation exist.
This is done by code on a form load event
If txtCount = 0 Then
DoCmd.OpenForm ("frmContactsUpdates"), acNormal
DoCmd.Close acForm, "frmContactsNoInvestor"
This works if I create a breakpoint and step through the code. If I remove the break point it does not seem to stop where it should.
11-29-10, 09:56 #2Moderator
Provided Answers: 19
- Join Date
- Jun 2005
- Richmond, Virginia USA
To be honest I'm a little fuzzy as to exactly what you're doing here, but how is txtCount populated? Are you sure that txtCount is ever equal to Zero? If the control is simply empty it would be Null, rather than Zero, and wouldn't cause your code to execute.
Unless you're sure that the control is being populated with a Zero, if the organization doesn't exist, a better check might be
If Nz(Me.txtCount, "") = "" Then
Linq ;0)>Hope this helps!
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007