Change RecordSource with Option Group (1 Viewer)

Endojoe

Registered User.
Local time
Today, 00:15
Joined
Apr 7, 2009
Messages
20
I have two tables, 'table1' has around 4500 records but is no longer being added to because I have created 'table2' to take it's place due to the fact that I couldn't set a couple fields in 'table1' to be indexed with no duplicates (over the years many duplicates had already been carelessly entered, and it would take too long to fix them all).

Unfortunately, I need to be able to go back and look through the records in table1 from time to time. table1 and table2 are identical (except for the aformentioned couple of fields that now will not allow duplicates). I was thinking an Option Group or Toggle Button would be great to switch the 'form1' record source between the two tables, but for the life of me, in all my searching, here and with Google, I have been unable to find a way to accomplish this. :confused:

Thank you all in advance,

-Will-
 

missinglinq

AWF VIP
Local time
Today, 01:15
Joined
Jun 20, 2003
Messages
6,423
This uses a standard command button and toggles its Caption and function.

In Design View:
  1. Create a command button named ToggleRecordSource
  2. Make its Caption "Table2"
  3. Set Table1 as the RecordSource so that's the records that will originally populate the form
  4. Then put this code behind the command button:
Code:
Private Sub ToggleRecordSource_Click()
 If ToggleRecordSource.Caption = "Table2" Then
  Me.RecordSource = "Table2"
  ToggleRecordSource.Caption = "Table1"
 Else
  Me.RecordSource = "Table1"
 End If
End Sub
 

Endojoe

Registered User.
Local time
Today, 00:15
Joined
Apr 7, 2009
Messages
20
Well....that was simple enough. :cool: Thanks a ton missinglinq!!! :D I have no idea why I couldn't find something so clear and concise on my own. :eek: Thanks a bunch again. :) Worked like a charm.
 

Users who are viewing this thread

Top Bottom