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

Updating a query result (table) in a subform

P: 8
Greetings fellow Accessers!

Im new but in Access, but I have some background in different coding.

I have a programme loading customer data into Access belonging to BMW dealers in Europe.

Every dealer reports several customers and I have today a query that sorts out how many customer data each BMW dealer sends in to us. The query is also referring to a startdate and enddate (to be filled in in a messagebox) so that i can choose time period for lets say October, and then look at the deliveries only for october.

I want to make this dynamic with text boxes as entry fields in a form, and the result table in a subform.

This one will be easy for ya!

In a form I have:

Startdate
Enddate

Subform Listing:
(Dealer X, No. entries of customer data)
(Dealer Y, No. entries of customer data)
(Dealer Z, No. entries of customer data)
....

How can i set values in the Startdate & Enddate and then Update the Subform Result? The query is already linked to the boxes - so thats not the problem!

How can I make it dynamic so that lets say a CommandButton can update the Query Result in the Subform?

Thanks for helping out!

//Daniel
Nov 8 '06 #1
Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,271
You will have to change the field names to your own, as I don't know what yours are.
Try setting the 'RecordSource' property of the subform to something like :-
Expand|Select|Wrap|Line Numbers
  1. {Specify subform here}.RecordSource = _
  2.     "SELECT [DealerID], Count([DealerID]) AS NoCusts " & _
  3.     "FROM [tblDealer]"
  4.     "WHERE ([EntryDate] Between #" & Format(Startdate, "M/D/YYYY") & _
  5.             "# And #" & Format(Enddate, "M/D/YYYY") & "#) " & _
  6.     "GROUP BY [DealerID]"
This code should be executed as part of the CommandButton OnClick event procedure.
Nov 8 '06 #2

Post your reply

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