Open Form Button Not Working Properly

R

Rhythm

I am currently creating a database that tracks customers,
contacts, projects, products, events, reservations and
orders.

I have created a series of forms based upon my tables.

On the Customer form {this will most likely be my main
form} I have buttons that open forms which allow me to add
contacts, shipping information and projects to the
customer record. All of the buttons work properly with
CustomerID being the field which filters the records for
the dependent forms. When I open the forms, the CustomerID
is already visible in its proper field. However, when I
try to add an order, the CustomerID is not visible thus
forcing me to enter the CustomerID manually. If I do not
enter the CustomerID but add all of the details to the
order and close it, then refer to the Orders table, there
is no CustomerID. In addition to that, after I've entered
the Order information completely {including manually
entering the CustomerID} and then close the order form, if
I back to the Customer form and click the "Orders" button,
it will open the Orders form and the form is filtered,
however when I keep the filtered form open, scroll to the
next record to add another order, the CustomerID field is
blank again.

Any suggestions?
 
G

Guest

When you open another form to add a record, force the Customer ID:.

DoCmd.OpenForm stDocName, , , acNew
forms!frmOrders!CustomerID.value=Me!CustomerID.value

This creates a new record with the customer ID.

If you're already in the Orders form & want to add a new record, making sure
that the Customer ID matches the current record in the Customer form:

DoCmd.GoToRecord , , acNewRec
Me!CustomerID.value=forms!frmCustomers!CustomerID.value

Make sure you save the record in code & refresh the original form so the new
data is displayed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top