Solved

save filtered records on form.

Posted on 2013-01-24
3
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

687 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