Solved

save filtered records on form.

Posted on 2013-01-24
3
364 Views
Last Modified: 2013-01-24
I have a form and have filtered the records down, how can I save just the filtered records? the form is of continuous, i dont need to save every field though. am in access 2010 using vba
0
Comment
Question by:PeterBaileyUk
  • 2
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 38813603
Do you mean save them into a table other than what the form is bound to?

The subforms recordsetclone can be used for this - it contains the filtered records:

Dim rs as dao.recordset
Set rs = Forms!yourformname.recordsetclone

dim rsOut as dao.recordset '<--- this is the table where you are saving records to
set rsout = currentdb.openrecordset ("YourTable", dbopendynaset)

if rs.recordcount = 0 then 
      Msgbox "no records in form"
      exit sub
end if

do until rs.eof
      rsOut.edit  ' or addnew if you are creating new records
      rsOut!Field1 = rs!field1
      rsOut!Field2 = rs!field2
      rsout.update
      rs.MoveNext
Loop
set rs= nothing
rsout.close
set rsout = nothing

Open in new window

0
 

Author Comment

by:PeterBaileyUk
ID: 38813612
yes to save as you described
0
 

Author Closing Comment

by:PeterBaileyUk
ID: 38813705
thank you
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question