How to I go about this!

B

Bob V

I have a continuous form that shows all my Invoices (Records) but after 3
years the records 2800 takes a few seconds to load up each time I open the
form,The Row source is qryClient, but I have created another
qryClientOneYear which sorts my records to the last year, My question is how
do I create a toggle so as I can choose which query I would like to run in
my continuous form?
 
T

tina

simply change the form's RecordSource property from one query name to the
other. exactly how you do that depends on whether you want to choose
*before* opening the form (from another form), or while the form is open, or
both. for specific instructions, you'll need to provide that information.

hth
 
B

Bob V

Thanks Tina, I've tried making 2 Forms with different queries but I run in
to trouble when I try and edit them, If I had a toggle on the form that
would change just the query from qryClientOnly to
qryClientOnlyOneYear..............is it possible to change just the Row
Source.........Thanks for the help...Bob
 
G

Gina Whipp

Bob,

Try this...
Set the record source of your form to qryClient. Create a command button
and paste this code behind it.

If Me.YourCommandButtonName.Caption = "Show All Years" Then
Me.cmdShowPaid.Caption = "Show Last Year"
Me.RecordSource = "qryClientOneYear"
Else
Me.cmdShowPaid.Caption = "Show All Years"
Me.RecordSource = "qryClient"
End If
 
T

tina

take a look at Gina's post elsewhere in this thread, Bob - that should do it
for you.

hth
 
G

Gina Whipp

Oops boo-boo, please use this one....

If Me.YourCommandButtonName.Caption = "Show All Years" Then
Me.YourCommandButtonName.Caption = "Show Last Year"
Me.RecordSource = "qryClientOneYear"
Else
Me.YourCommandButtonName.Caption = "Show All Years"
Me.RecordSource = "qryClient"
End If
 
B

Bob V

Gina Im a little bit lost do I add a command button to my form or do I alter
the command button I already have that opens my form?
When you say place behind, in that OnClick of the Command Button?
thanks for your help.Bob
 
G

Gina Whipp

Bob,

I see you have a command button on your form. (I missed that in your
earlier post.) Place the code behind the On_Click event and where it says
YourCommmanButtonName place the name of your command button.
 
B

Bob V

Gina it not changing the amount of records in my List Box [lstModify] it is
playing around [#Name!]with my Record Source that I have a couple of yes/no
fields to on this form...thanks for your help Bob.
Private Sub cmdInvoices_Click()
If Me.cmdInvoices.Caption = "Show All Years" Then
Me.cmdInvoices.Caption = "Show Last Year"
Me.RecordSource = "qryClientOnlyYear"
Else
Me.cmdInvoices.Caption = "Show All Years"
Me.RecordSource = "qryClientOnly"
End If


End Sub
 
G

Gina Whipp

Bob,

Ummm, first I heard list box, must have missed that... change code to

If Me.cmdInvoices.Caption = "Show All Years" Then
Me.cmdInvoices.Caption = "Show Last Year"
Me.lstModify.RowSource = "qryClientOnlyYear"
Else
Me.cmdInvoices.Caption = "Show All Years"
Me.lstModify.RowSource = "qryClientOnly"
End If


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
Bob V said:
Gina it not changing the amount of records in my List Box [lstModify] it
is playing around [#Name!]with my Record Source that I have a couple of
yes/no fields to on this form...thanks for your help Bob.
Private Sub cmdInvoices_Click()
If Me.cmdInvoices.Caption = "Show All Years" Then
Me.cmdInvoices.Caption = "Show Last Year"
Me.RecordSource = "qryClientOnlyYear"
Else
Me.cmdInvoices.Caption = "Show All Years"
Me.RecordSource = "qryClientOnly"
End If


End Sub
Gina Whipp said:
Bob,

I see you have a command button on your form. (I missed that in your
earlier post.) Place the code behind the On_Click event and where it
says YourCommmanButtonName place the name of your command button.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II
 
B

Bob V

Gina your a genius thanks you very much for your help it is much appreciated
......Bob :))

Gina Whipp said:
Bob,

Ummm, first I heard list box, must have missed that... change code to

If Me.cmdInvoices.Caption = "Show All Years" Then
Me.cmdInvoices.Caption = "Show Last Year"
Me.lstModify.RowSource = "qryClientOnlyYear"
Else
Me.cmdInvoices.Caption = "Show All Years"
Me.lstModify.RowSource = "qryClientOnly"
End If


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
Bob V said:
Gina it not changing the amount of records in my List Box [lstModify] it
is playing around [#Name!]with my Record Source that I have a couple of
yes/no fields to on this form...thanks for your help Bob.
Private Sub cmdInvoices_Click()
If Me.cmdInvoices.Caption = "Show All Years" Then
Me.cmdInvoices.Caption = "Show Last Year"
Me.RecordSource = "qryClientOnlyYear"
Else
Me.cmdInvoices.Caption = "Show All Years"
Me.RecordSource = "qryClientOnly"
End If


End Sub
Gina Whipp said:
Bob,

I see you have a command button on your form. (I missed that in your
earlier post.) Place the code behind the On_Click event and where it
says YourCommmanButtonName place the name of your command button.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

Gina Im a little bit lost do I add a command button to my form or do I
alter the command button I already have that opens my form?
When you say place behind, in that OnClick of the Command Button?
thanks for your help.Bob

Oops boo-boo, please use this one....

If Me.YourCommandButtonName.Caption = "Show All Years" Then
Me.YourCommandButtonName.Caption = "Show Last Year"
Me.RecordSource = "qryClientOneYear"
Else
Me.YourCommandButtonName.Caption = "Show All Years"
Me.RecordSource = "qryClient"
End If


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II
Bob,

Try this...
Set the record source of your form to qryClient. Create a command
button and paste this code behind it.

If Me.YourCommandButtonName.Caption = "Show All Years" Then
Me.cmdShowPaid.Caption = "Show Last Year"
Me.RecordSource = "qryClientOneYear"
Else
Me.cmdShowPaid.Caption = "Show All Years"
Me.RecordSource = "qryClient"
End If


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II



I have a continuous form that shows all my Invoices (Records) but
after 3 years the records 2800 takes a few seconds to load up each
time I open the form,The Row source is qryClient, but I have created
another qryClientOneYear which sorts my records to the last year, My
question is how do I create a toggle so as I can choose which query
I would like to run in my continuous form?
 
G

Gina Whipp

Your most welcome!

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
Bob V said:
Gina your a genius thanks you very much for your help it is much
appreciated .....Bob :))

Gina Whipp said:
Bob,

Ummm, first I heard list box, must have missed that... change code to

If Me.cmdInvoices.Caption = "Show All Years" Then
Me.cmdInvoices.Caption = "Show Last Year"
Me.lstModify.RowSource = "qryClientOnlyYear"
Else
Me.cmdInvoices.Caption = "Show All Years"
Me.lstModify.RowSource = "qryClientOnly"
End If


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II
Bob V said:
Gina it not changing the amount of records in my List Box [lstModify] it
is playing around [#Name!]with my Record Source that I have a couple of
yes/no fields to on this form...thanks for your help Bob.
Private Sub cmdInvoices_Click()
If Me.cmdInvoices.Caption = "Show All Years" Then
Me.cmdInvoices.Caption = "Show Last Year"
Me.RecordSource = "qryClientOnlyYear"
Else
Me.cmdInvoices.Caption = "Show All Years"
Me.RecordSource = "qryClientOnly"
End If


End Sub
Bob,

I see you have a command button on your form. (I missed that in your
earlier post.) Place the code behind the On_Click event and where it
says YourCommmanButtonName place the name of your command button.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

Gina Im a little bit lost do I add a command button to my form or do I
alter the command button I already have that opens my form?
When you say place behind, in that OnClick of the Command Button?
thanks for your help.Bob

Oops boo-boo, please use this one....

If Me.YourCommandButtonName.Caption = "Show All Years" Then
Me.YourCommandButtonName.Caption = "Show Last Year"
Me.RecordSource = "qryClientOneYear"
Else
Me.YourCommandButtonName.Caption = "Show All Years"
Me.RecordSource = "qryClient"
End If


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II
Bob,

Try this...
Set the record source of your form to qryClient. Create a command
button and paste this code behind it.

If Me.YourCommandButtonName.Caption = "Show All Years" Then
Me.cmdShowPaid.Caption = "Show Last Year"
Me.RecordSource = "qryClientOneYear"
Else
Me.cmdShowPaid.Caption = "Show All Years"
Me.RecordSource = "qryClient"
End If


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II



I have a continuous form that shows all my Invoices (Records) but
after 3 years the records 2800 takes a few seconds to load up each
time I open the form,The Row source is qryClient, but I have
created another qryClientOneYear which sorts my records to the last
year, My question is how do I create a toggle so as I can choose
which query I would like to run in my continuous form?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top