473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Change Form Source Recordset Dynamically

I have a form that is used to display patient records. It's default
Recordset is set to a query which shows only current clients. I want
to use an option box on the form to force the form to use the client
table (tblClients) as it's source Recordset, which would display ALL
clients (past and present), not just current clients. How do I
accomplish this?
Jul 4 '08 #1
1 2582
ch***************@charter.net wrote:
I have a form that is used to display patient records. It's default
Recordset is set to a query which shows only current clients. I want
to use an option box on the form to force the form to use the client
table (tblClients) as it's source Recordset, which would display ALL
clients (past and present), not just current clients. How do I
accomplish this?
I might create an OptionGroup with 3 checkbox options; Current,
Archived, All in the form's FormHeader band. Give it a name like
FramePatients. Set the default to 1 which would be current patients.

Your form's recoursource should have no filter; a simple table or query
is all that is needed.

Then create a subroutine similar to the following.
Sub SetFilter()
Dim strF As String

Select Case Me.FramePatients
Case 1
'use your active status flag
strF = "ActivePatient = True"
Case 2
strF = "ActivePatient = False"
End Select

'since 3 is All, StrF will be ""
Me.Filter = strF
Me.FilterOn = (strF "")
End Sub

Now in the form's OnOpen event and the OnClick event of the Option group
enter
SetFilter
You'd open the form like this
Docmd.Openform "FormName"
without a filtering argument.

Pretty Wahine
http://www.youtube.com/watch?v=h9Wx63W_zBA
Jul 4 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
10
by: Lyn | last post by:
I have a form set to Single Form mode with which I can cycle through the records in a table via Next and Previous buttons. To avoid users pressing the Previous button on the first record and the...
3
by: Leo | last post by:
Hi everybody, Is there a way to fill a continuous form with an ADO recordset? Normally when I populate the form with the recordset only the first record is shown. I want to fill all records....
8
by: lauren quantrell | last post by:
When I open an Access form I can have no recordset specified, then in the form's OnOpen event I can do something like: Me.paramaters = "@SomeColumn = 22)" Me.recordsource = "dbo.sproc123" But I...
0
by: ghanley | last post by:
I have searched the web all day for a lead on this. I have found how to control the Graph object mut not the embedded excel unbound object frame. I am trying to chart the data below on one...
4
by: greg | last post by:
Hi, I don't think my message posted correctly so here it is. Is there any way to access the individual values of a form text box? I want to iterate through all of the rows and access the...
6
by: Greg Strong | last post by:
Hello All, Is is possible to use an ADO recordset to populate an unbound continuous Subform? I've done some Googling without much luck, so this maybe impossible, but let me try to explain...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
2
by: atlbearcat | last post by:
Here's one that's been bugging me for about a week now... I have a form that allows users to filter records, simple enough. But I want to give them the option to export the filtered records to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.