Solved

save filtered records on form.

Posted on 2013-01-24
3
365 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

733 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