How to I go about this!

  • Thread starter Thread starter Bob V
  • Start date Start date
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?
 
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
 
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
 
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
 
take a look at Gina's post elsewhere in this thread, Bob - that should do it
for you.

hth
 
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 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
 
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 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,

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 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?
 
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

Back
Top