Put results of a query into a text box

chancer1967

Excel jockey
Local time
Today, 08:28
Joined
Mar 31, 2004
Messages
28
I'm sure the title could be more elegant, but anyway...


I am creating a data import feature in my database.

And it works like this:

- user clicks the menu item "import data"
- a form loads and a file open dialog opens
- if they cancel the dialog, the form is closed
- otherwise, they select the file and the data is imported into a tblNewData (just before the import the existing tblNewData is deleted)

now then...

I want to have 3 queries that calculate totals from tblNewData - one is the sum of the cost field, one is sum of cost where myfield="x", one is sum of cost where myfield="y", and display these 3 figures on the form.

Originally I had tblNewData as the recordsource of my form but that prevents the tblNewData from being deleted.

So i figure what I need to do is have the form with no record source and then after the import have VBA add record source for the form and controlsources for the text boxes.

Does that make sense? How would I do it?
 
you could make them Listboxes and put the query to calculate the sums in the Rowsource.
 

Users who are viewing this thread

Back
Top Bottom