Append Filtered Data to another Table

ECEK

Registered User.
Local time
Today, 19:18
Joined
Dec 19, 2012
Messages
717
I have a Split Form (Yes yes I know !!)

I want the User to be able to filter the data and to then press a command button to append that data into another table.

At present they select all, copy, open new table and paste.

How do I apply the Split Form's data into VBA?

My initial thought was to have an additional radio button called "select"
when I press the command button it populates all of the filtered records with a yes". This can then be subsequently queried into an append query.

I'm struggling with that though !!

Thanks for pointing me in the right direction.
 
I don't use split forms, but typically you can read the filter property, so my first thought is executing SQL:

strSQL = "INSERT INTO...SELECT...FROM...WHERE " & Me.Filter
 
I figured out a solution: I have a command button on my split form called append data. Once the User has filtered as required they press this comd button to append it to the new table (represented by FORM2

Code:
Private Sub Command483_Click()

DoCmd.GoToControl "ID"
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdCopy
DoCmd.OpenForm "FORM2", acFormDS, "", "", , acNormal

DoCmd.RunCommand acCmdPasteAppend
DoCmd.Close

'I have then built a query from the existing data and my new table to delete what I have just pasted.

DoCmd.OpenQuery "dltAppendedData" 


End Sub

A bit vulgar but it does the trick.
 
Glad you found a solution. My method didn't work, or you just went this way first?
 
1. You almost certainly do not need to create a separate table to hold a copy of the data. Queries can be used in most instances as direct substitutes for tables.
2. If you want to export the data to Excel, you can still use Paul's suggestion. Ask if that is what you need to do.

Since Forms don't store data, tables store data, what you elected to do does not make sense in a programmable environment. Paul's suggestion is more flexible and more in tune with how this would properly be done. Just because it happens to work, doesn't mean that it is a technique you should put in your toolbox.
 
Hi Paul. Yes, I'd developed the solution before your post.

Pat.
The process is that the User selects the data that they want then pastes it into the table. It is then used and edited from there.

This is a selection process.
the data is imported from an excel file into Table1 it is filtered and the results are pasted into Table2 for further use.
 

Users who are viewing this thread

Back
Top Bottom