Weird things happening with the Me.OpenArgs

scooteman

Registered User.
Local time
Today, 05:11
Joined
Nov 30, 2009
Messages
57
I am building a simple sales record database for my wife who sells Watkins products.

I have a main form that lists all her customers. I open an Order Entry form using an OpenArg to pass the CustomerID to the order form and insert that value in the CustID field. Everything works fine except for the next record button at the bottom. If I click the next button, the form will automatically insert and save an new record for the customer instead of coming to an empty record with the next button grayed out. I can keep clicking the record and it will keep adding new empty records.

I also have a search box on the Order form so my wife can look at past orders for a customer. If I open this form off the main form, then use the search to go to a specific customer that has two records, I see the OpenArgs behave even stranger. I can click the next record button and the form will cycle through two records as it should. Then, if I click the next button a third time it will change the user ID to the first user ID on my main form and add an empty record. I forced my main form to close when the Order form opens but I still get the same behavior.

However, If I open the form from the navigation pane whole the main form is closed, the form will work like normal and the next buttons will stop at a new record.

My wife isn't real computer savvy and I am afraid she's going to end up inserting a bunch of empty records.

Why is the Open Argument doing this?
 
What does the code that is using the OpenArgs in the opened form look like?
 
What does the code that is using the OpenArgs in the opened form look like?


John,

I fixed the problem. I had the Open Argument in the On Current Event, when I switched it to the On Load Event, the form started to behave correctly.

This is what I had in the On Current Event:

Code:
If Me.NewRecord Then
    Me![CustID] = Me.OpenArgs
 
For the sort of thing you are doing, maybe the form's Filter and FilterOn properties might prove to be useful. Have a look at those when you can :)
 
For the sort of thing you are doing, maybe the form's Filter and FilterOn properties might prove to be useful. Have a look at those when you can :)


Thanks, I will look at that. I am trying to make the database as simple as I can for my wife to use. I had her using an old customized 97 access Northwind database for the last few years, but my wife has never liked it. Then this year it wouldn't convert to Access 2007 without lots of errors. My wife is smart but she and computers don't always get along. Hence, for my peace, I'm trying to make this simple. :)
 
Thanks, I will look at that. I am trying to make the database as simple as I can for my wife to use. I had her using an old customized 97 access Northwind database for the last few years, but my wife has never liked it. Then this year it wouldn't convert to Access 2007 without lots of errors. My wife is smart but she and computers don't always get along. Hence, for my peace, I'm trying to make this simple. :)
I think you can't convert from 97 straight to 2007. You would need to convert 97 to 2000, then from 2000 to 2007.

Have fun with the rest of your development.
 

Users who are viewing this thread

Back
Top Bottom