PC Review


Reply
Thread Tools Rate Thread

How to change Form RecordSource?

 
 
=?Utf-8?B?Q2hyaXNC?=
Guest
Posts: n/a
 
      19th Apr 2006
I am having a bit of trouble getting a Form to change the RecordSource.

I have 2 Forms -- one is a Login Form, and the other is an Admin form for
administering data.

The user clicks on their respective name in the Login form (no pwd
required), and it should change the RecordSource on the Admin form to the
matching users' data set.

I set the following code behind the OnClick event:

Form_TestForm.RecordSource = "Table2"

And it doesn't change the dataset. I also tried this code:

Forms!USA.RecordSource = "USA_Jim"

And that also doesn't work...

Anyone have any ideas? I thought it was simple, and found out it wasn't!

Thanks
 
Reply With Quote
 
 
 
 
Marshall Barton
Guest
Posts: n/a
 
      19th Apr 2006
ChrisB wrote:

>I am having a bit of trouble getting a Form to change the RecordSource.
>
>I have 2 Forms -- one is a Login Form, and the other is an Admin form for
>administering data.
>
>The user clicks on their respective name in the Login form (no pwd
>required), and it should change the RecordSource on the Admin form to the
>matching users' data set.
>
>I set the following code behind the OnClick event:
>
> Form_TestForm.RecordSource = "Table2"
>
>And it doesn't change the dataset. I also tried this code:
>
> Forms!USA.RecordSource = "USA_Jim"
>
>And that also doesn't work...
>
>Anyone have any ideas? I thought it was simple, and found out it wasn't!



Forms!USA.RecordSource = "USA_Jim"
should work as long as USA_Jim is the name of a table or
query.

Don't forget that the form USA must be open before you can
reference it.

--
Marsh
MVP [MS Access]
 
Reply With Quote
 
=?Utf-8?B?Q2hyaXNC?=
Guest
Posts: n/a
 
      19th Apr 2006
Ah! That might be the problem. I'm trying to run the command before the Form
is open.

I'll give it a try tomorrow at work and see how it goes..

Thanks again!

-Chris

"Marshall Barton" wrote:

> ChrisB wrote:
>
> >I am having a bit of trouble getting a Form to change the RecordSource.
> >
> >I have 2 Forms -- one is a Login Form, and the other is an Admin form for
> >administering data.
> >
> >The user clicks on their respective name in the Login form (no pwd
> >required), and it should change the RecordSource on the Admin form to the
> >matching users' data set.
> >
> >I set the following code behind the OnClick event:
> >
> > Form_TestForm.RecordSource = "Table2"
> >
> >And it doesn't change the dataset. I also tried this code:
> >
> > Forms!USA.RecordSource = "USA_Jim"
> >
> >And that also doesn't work...
> >
> >Anyone have any ideas? I thought it was simple, and found out it wasn't!

>
>
> Forms!USA.RecordSource = "USA_Jim"
> should work as long as USA_Jim is the name of a table or
> query.
>
> Don't forget that the form USA must be open before you can
> reference it.
>
> --
> Marsh
> MVP [MS Access]
>

 
Reply With Quote
 
=?Utf-8?B?Q2hyaXNC?=
Guest
Posts: n/a
 
      20th Apr 2006
I tried this out, and it worked perfectly!!

Just had to make it change the source AFTER the form loaded/opened.

Thanks!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change form field upon recordsource change ryan.fitzpatrick3@safeway.com Microsoft Access Form Coding 2 1st May 2009 06:32 PM
Can you change a form recordsource? ryan.fitzpatrick3@safeway.com Microsoft Access Form Coding 3 16th Oct 2008 06:29 PM
Change Recordsource on Hidden Form pic078 via AccessMonster.com Microsoft Access Form Coding 2 17th Jan 2007 03:58 PM
Can't change a form's recordsource =?Utf-8?B?Sm9obm55IEJyaWdodA==?= Microsoft Access Form Coding 1 27th May 2006 10:51 AM
Using recordsource to change a form's query =?Utf-8?B?Q2hvY2t5NjY=?= Microsoft Access Forms 5 4th Nov 2005 12:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:36 PM.