By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,255 Members | 2,773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,255 IT Pros & Developers. It's quick & easy.

Can a combo box be restricted to display certain data

imrosie
100+
P: 222
Hello All,

I have a combo box that selects a customer and brings up all of the data associated with that customer (Billing data (on Main form), Order data (on Sub form #1) and Shipping Data on Sub form #2)...

The combo box is unbound and uses a select table/query.
Both subforms are 'bridged together' with the main form, so when you select a customer name all 3 forms populate...

Main form - based on Customer table
Sub form 1 - based on Order Detail table
Sub form 2 - based on Order table

It's the data from Sub form 1 and 2 that I don't want 'old' information to appear. I do need these forms 'bridged' so when I enter NEW info into sub 1 and sub 2, it will be stored in the appropriate tables.

Here's the code for the combo box:
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCTROW Customers.CustomerID, [FirstName] & " " & [LastName] FROM Customers ORDER BY [FirstName] & "," & [LastName]; 

There's also an 'After Update' event associated with 'custname':
Expand|Select|Wrap|Line Numbers
  1. Private Sub custname_AfterUpdate()
  2. Me.FilterOn = True
  3. Me.Filter = "CustomerID = " & Me.custname
  4. Me.Requery
  5. End Sub()
Thanks for any help you can provide..
Rosie
Sep 13 '07 #1
Share this Question
Share on Google+
1 Reply


Scott Price
Expert 100+
P: 1,384
Hi Rosie,

How are you going to differentiate between old and new data? Is there a date field that you can filter by?

Your combo box can be filled with a SELECT query (just like you have) but all that you need to add is a WHERE [tableX].[OrderDate] = [SomeDate]

Regards,
Scott
Sep 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.