By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,763 Members | 1,609 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,763 IT Pros & Developers. It's quick & easy.

Change Record Source on switching View to Datasheet

P: n/a
Hi,

A question regarding Access 2002:

I've got a form which should be displayed in Form View and in Datasheet
View. But I want to use a different record source for each view. That
means, when the view is switched I want to switch the record source
also.

I tried to put this functionality on the "On View Change" event, but
this did not work - the record source stayed unchanged. I tried it in
the "On Current" event, but this leads the form to endlessly requery.
But where else could I put the functionality of changing the record
source? Is it even possibel to change the record source in correlation
with changing the view?

Thanks,
Stephan

Feb 9 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
steph wrote:
Hi,

A question regarding Access 2002:

I've got a form which should be displayed in Form View and in
Datasheet View. But I want to use a different record source for each
view. That means, when the view is switched I want to switch the
record source also.

I tried to put this functionality on the "On View Change" event, but
this did not work - the record source stayed unchanged. I tried it in
the "On Current" event, but this leads the form to endlessly requery.
But where else could I put the functionality of changing the record
source? Is it even possibel to change the record source in correlation
with changing the view?

Thanks,
Stephan


Two views - one RecordSource (makes sense)
One view - two RecordSources (makes sense)
Two views - two RecordSources (?????????)

Why don't you just use two forms?

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Feb 9 '06 #2

P: n/a
As it is the same underlying table, only 2 different queries filtering
the data, I thought it fits to do it this way. But you're right, I can
also solve this with 2 tables. Less elegant, maybe.

br,
stephan

Feb 9 '06 #3

P: n/a
steph wrote:
As it is the same underlying table, only 2 different queries filtering
the data, I thought it fits to do it this way. But you're right, I can
also solve this with 2 tables. Less elegant, maybe.

br,
stephan


I never suggested two tables. If by "two diffferent queries" you actually mean
the same query structure just with different selection criteria then all you
should need to do is change the form's filter, no?

Otherwise changing the RecordSource and then the view from the code of a command
button should work.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Feb 10 '06 #4

P: n/a
Oh, I'm sorry, in my last post I meant to say "2 forms" instead of "2
tables"!

The 2 queries I have not only differ in their filter criteria, but also
in the columns they return. I could do the changing of record-source
with a command button, yes. But my initial idea was, that there might
be an event that's triggered when view is switched between form and
datasheet. apparently there is not?

In the meantime I have solved this with 2 forms, as you proposed.

Thanks,
stephan

Feb 10 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.