Sub form (1 Viewer)

randolphoralph

Registered User.
Local time
Today, 05:45
Joined
Aug 4, 2008
Messages
101
I have a form that contains order information with the salesperson id.

At the bottom of the form I have a subform which displays all the records (orders) of the unique sales person based on the salesperson id that is entered on the record.

Once the salesperson id is entered I am running an After Update to refresh to show the orders in the sub form.

Code:
Private Sub SalespersonId_AfterUpdate()
Me.Refresh
End Sub

When the salesperson first starts filling in information on the form there are a couple of fields that they fill in before they put in the salesperson id.

The issue is that as soon as they began filling in the first field (Order Date) on a new record the subform displays the orders of salesperson from the last record entered. Once the salesperson id is entered on the new record the data is refreshed on the subform.

How do I prevent data showing on the subform until the salesperson id is entered?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:45
Joined
Feb 19, 2002
Messages
43,331
Check the master/child links for the subform control. When they are properly set, the subform will be empty for a new main form record.
 

randolphoralph

Registered User.
Local time
Today, 05:45
Joined
Aug 4, 2008
Messages
101
Thanks Pat...Looks like I had misspelled on the field name on the Child.
 

randolphoralph

Registered User.
Local time
Today, 05:45
Joined
Aug 4, 2008
Messages
101
I spoke too soon...I have both the Master and Child set to SalespersonID and it still has the same issue.

The subform is blank on a new record, but as soon as I type in the 1st field the subform populates with data from the last record.
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:45
Joined
Feb 19, 2002
Messages
43,331
Does the subform have a query as the recordsource? Does the query have criteria? Is there code in the form that is causing this?

Try exporting the form/subform, tables, and queries to a new database. Are you having the same problem? Post the stripped down database and we'll look at it.
 

Users who are viewing this thread

Top Bottom