Connecting Tech Pros Worldwide Forums | Help | Site Map

ACCESS 97 Recordsets

Paul
Guest
 
Posts: n/a
#1: Nov 13 '05
I could really use some help please.

SETUP:
I have a table called "ProductTable"
I have a query called "ProductQuery" based on ProductTable
I have a form Called "ProductMF" based on ProductQuery
I have another table called TempProductTable (same as ProductTable, but
without the primary key..."ProductID")

SITUATION:
I want the user to be able to filter the ProductMF...anyway they want, then
I want a piece of code on a button to copy the filtered records from the
form into the TempProductTable.

SO FAR:
I started to do this using a recordsetclone for the form and a recordset for
the temp table. Then I realized that I would have to do this for each and
every textbox, combobox, checkbox, etc. control on the from and save it to
the appropriate field in the TempProductTable.

I was wondering if there was an easier way to save the filtered recordset of
the form into the TempProductTable?...something like an export possibly.

Thanks in advance.

Paul



Salad
Guest
 
Posts: n/a
#2: Nov 13 '05

re: ACCESS 97 Recordsets


Paul wrote:
[color=blue]
> I could really use some help please.
>
> SETUP:
> I have a table called "ProductTable"
> I have a query called "ProductQuery" based on ProductTable
> I have a form Called "ProductMF" based on ProductQuery
> I have another table called TempProductTable (same as ProductTable, but
> without the primary key..."ProductID")
>
> SITUATION:
> I want the user to be able to filter the ProductMF...anyway they want, then
> I want a piece of code on a button to copy the filtered records from the
> form into the TempProductTable.
>
> SO FAR:
> I started to do this using a recordsetclone for the form and a recordset for
> the temp table. Then I realized that I would have to do this for each and
> every textbox, combobox, checkbox, etc. control on the from and save it to
> the appropriate field in the TempProductTable.
>
> I was wondering if there was an easier way to save the filtered recordset of
> the form into the TempProductTable?...something like an export possibly.
>
> Thanks in advance.
>
> Paul
>[/color]

You could create an append query that appends the records to the temp
table. This query would have no filter.

Now, open up the query in SQLView. Copy and paste it into your code for
the button and assign it to a variable. Ex:

strSQL = "INSERT INTO Temp SELECT Table1.* FROM Table1 "

(the above won't work since Table1 has a key field which in your case
does not exist in Temp so you need to specifiy the fields to
append....or create a query called ProductQueryWithoutID if you have a
real long field list.)

strSQL = "INSERT INTO Temp SELECT ProductQueryWithoutID.* FROM
ProductQueryWithoutID "

Then you can do something like

strSQL = strSQL & " Where " & Me.Filter
Currentdb.Execute strSQL




Closed Thread