open form in edit mode rather than add?

A|ex

Registered User.
Local time
Today, 14:44
Joined
Jul 11, 2004
Messages
90
i am having some problems with some code i am trying to write. I want to open up a sales form for a customer. I am keeping it to one sale per each customer. the problem i am having is i want a NEW form to open for each customer. After the new form has been opened and data has been entered and closed. I want the same form again to be opened this time in EDIT mode if the sale already exists.

Is it possible have some sort of field check before opening the form?

What is the code i need to write?

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Sales"
stLinkCriteria = "[ContractNumber]=" & "'" & Me![ContractNumber] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
-----
will open a NEW form in add mode, how do i implement an if statement to check the fields in both customer and sales before opening?

cheers
 
Might want to rethink the structure...

If you think of relationship between sales and customers... 1 customer many sales. Your description seems to be leaning towards 1 customer with 1 sale which changes over time, which I don't think is correct (although anything is possible). Do you have seperate tables for customers and sales?
What I think you really want to do is search for existing sales for a given customer, and if there is an existing or "pending" sale, modify it and if there is no existing sale, enter a new one.

Are my assumptions correct?
 
yes your assumption is correct with a 1 to 1 relationship (for the time being)
 
okay...so how many tables

Still think you should think about the structure before tackling the original problem.
 

Users who are viewing this thread

Back
Top Bottom