Drop Down List / Open Report

B

Bob V

How do I go about setting my Combo Box to open any one of my ten reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob
 
J

John W. Vinson

How do I go about setting my Combo Box to open any one of my ten reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob

If the reports are based on correct queries which already filter the results
as desired, just:

Private Sub comboboxname_Click()
DoCmd.OpenReport Me.comboboxname
End Sub

See the online help for OpenReport for the various options - you can open it
in preview mode or print it directly, pass arguments, etc.

John W. Vinson [MVP]
 
B

Bob V

I suppose I have done this wrong I have 4 queries from the same table all 4
queries using the same Fields, But I have 4 different reports using the same
formats, I have just Record Source to each query is that Ok to
do..................Thanks Bob

John W. Vinson said:
How do I go about setting my Combo Box to open any one of my ten reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob

If the reports are based on correct queries which already filter the
results
as desired, just:

Private Sub comboboxname_Click()
DoCmd.OpenReport Me.comboboxname
End Sub

See the online help for OpenReport for the various options - you can open
it
in preview mode or print it directly, pass arguments, etc.

John W. Vinson [MVP]
 
J

John W. Vinson

I suppose I have done this wrong I have 4 queries from the same table all 4
queries using the same Fields, But I have 4 different reports using the same
formats, I have just Record Source to each query is that Ok to

How do the queries differ? Just in a parameter query criterion? I think you
may need only *one* report based on *one* parameter query, perhaps referencing
a control on your switchboard form.

John W. Vinson [MVP]
 
B

Bob V

Thanks John, The queries differ from >Date()-365, >Date()-720 and Like
"*Vet*" and Like "*Transport*" and so on , its just to show you what you
have charges for these with the name in and other queries are just all on a
time base.............Thanks Bob
 
J

John W. Vinson

Thanks John, The queries differ from >Date()-365, >Date()-720 and Like
"*Vet*" and Like "*Transport*" and so on , its just to show you what you
have charges for these with the name in and other queries are just all on a
time base.............Thanks Bob

I'm sorry... without knowing anything about your database or your business
model, that sentence simply doesn't communicate.

I guess you can use four reports with four different queries, though with a
modest amount of code you could use just a single report (by passing a
WhereCondition from the combo box).

John W. Vinson [MVP]
 
T

Tom Ventouris

If you must have four reports, you are on the right track.

Name each of your reports and put the names in the Combo Box, Value List.
In the AfterUpdate Evenet of the compbo box righta Select Case.....

Select Case Me![ComboBox]
Case is = "Report 1"
DoCmd.OpenReport "Report1", acViewPreview, "", "", acNormal
Case is = "Report2"
DoCmd.OpenReport "Report2", acViewPreview, "", "", acNormal
and so on.....this will open the reports in preview.
End select

Subsritute names of your reports and the combo box. Note the descriptive
names in the combo box need not be the actual names of the reports.

Hope this helps.
 
T

Tom Ventouris

You can, with some code, accomplish this with one report, however if you must
have four:

List the names of your reports in the Combo Box, Value List. These need not
be the actual names of the reports but can be some descriptive name for the
user to select from.

In the After Update Event of the combo box, write a select case:

Select Case Me![ComboBoxName]
Case is = "Report1"
DoCmd.OpenReport "Report1", acViewPreview, "", "", acNormal
Case is = "Report2"
DoCmd.OpenReport "Report2", acViewPreview, "", "", acNormal
and so on.....
End select

Substitute for the report name in the Docmd ines.
The descripticve name in the Case is... line, as it appears in the combo box
value list.

Hope this helps.
 
T

Tom Ventouris

If you must have 4 reports, rather than one with code to pass parameters, try
this:

Assigne descriptive names to your reports, for the user, and put these in
the ComboBox Value List.

In the Combo Box After Update Event:

Select Case Me![ComboBoxName}
Case is = "DescriptiveName"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
Case is = "Next Descriptive Name"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
and so on.....
End select
 
T

Tom Ventouris

Apologies for the repetition, I kept receiving a "fail" message.
Note the correction:
Select Case Me![ComboBoxName]


Tom Ventouris said:
If you must have 4 reports, rather than one with code to pass parameters, try
this:

Assigne descriptive names to your reports, for the user, and put these in
the ComboBox Value List.

In the Combo Box After Update Event:

Select Case Me![ComboBoxName}
Case is = "DescriptiveName"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
Case is = "Next Descriptive Name"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
and so on.....
End select


Bob V said:
How do I go about setting my Combo Box to open any one of my ten reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob
 
B

Bob V

Thanks Tom, can you give me your opinion which is best, Drop Down Combo Box
or a Report?
All I am using it for is to see what charges and how much they where for
reference only, so I can what I have charged before.
Does one take longer to load, and which is the more Stable/Suitable?
Thanks for your help....Bob

Tom Ventouris said:
Apologies for the repetition, I kept receiving a "fail" message.
Note the correction:
Select Case Me![ComboBoxName]


Tom Ventouris said:
If you must have 4 reports, rather than one with code to pass parameters,
try
this:

Assigne descriptive names to your reports, for the user, and put these in
the ComboBox Value List.

In the Combo Box After Update Event:

Select Case Me![ComboBoxName}
Case is = "DescriptiveName"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
Case is = "Next Descriptive Name"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
and so on.....
End select


Bob V said:
How do I go about setting my Combo Box to open any one of my ten
reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob
 
B

Bob V

I think that the Open Report is easier to view and takes up less room on my
form as I am a bit tight for room, and I suppose you can always print it of
too. be interested to know what you think ComboBox versus The Open
report?....Thanks Bob
Bob V said:
Thanks Tom, can you give me your opinion which is best, Drop Down Combo
Box or a Report?
All I am using it for is to see what charges and how much they where for
reference only, so I can what I have charged before.
Does one take longer to load, and which is the more Stable/Suitable?
Thanks for your help....Bob

Tom Ventouris said:
Apologies for the repetition, I kept receiving a "fail" message.
Note the correction:
Select Case Me![ComboBoxName]


Tom Ventouris said:
If you must have 4 reports, rather than one with code to pass
parameters, try
this:

Assigne descriptive names to your reports, for the user, and put these
in
the ComboBox Value List.

In the Combo Box After Update Event:

Select Case Me![ComboBoxName}
Case is = "DescriptiveName"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
Case is = "Next Descriptive Name"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
and so on.....
End select


:



How do I go about setting my Combo Box to open any one of my ten
reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob
 
B

Bob V

Tom Could you use a Dropdown Combo List to open Combos Like these two Combos
Similar to opening Reports?...thanks for the help...Bob

Me.cmbCharge1Y.Requery
Me.cmbCharge1Y.SetFocus
Me.cmbCharge1Y.Dropdown

Me.CmbCharge2Y.Requery
Me.CmbCharge2Y.SetFocus
Me.CmbCharge2Y.Dropdown

Tom Ventouris said:
Apologies for the repetition, I kept receiving a "fail" message.
Note the correction:
Select Case Me![ComboBoxName]


Tom Ventouris said:
If you must have 4 reports, rather than one with code to pass parameters,
try
this:

Assigne descriptive names to your reports, for the user, and put these in
the ComboBox Value List.

In the Combo Box After Update Event:

Select Case Me![ComboBoxName}
Case is = "DescriptiveName"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
Case is = "Next Descriptive Name"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
and so on.....
End select


Bob V said:
How do I go about setting my Combo Box to open any one of my ten
reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob
 
T

Tom Ventouris

Hi Bob

A report or combo box? These are totally diffrent, and for a different
purpose.
It is really not clear to me what you are trying to accomplish. If you are
looking for the history of a record, the report you are planning, opened via
the combo box will do the job. At the risk of being mistaken for an expert on
this, I would have used a subform or linked form to dispaly the record
history. A subform can be placed in a seperate page, if you don't have space,
(use tabs) but this may take longer to load with the additional data and
fields on a form. A linked form can be loaded through a command button on
demand.

Your last post indicates that you may want to populate one combo box with
the record history based on the selection in another combo box. If this is
it, it can be done. Search this group or create a new post for help on
setting the combobox row source based on a selection.....

Hope this helps, but some more info on your design and need will get you
better advice from this group, I gather from your questions and other
responses on this posting that whatever it might be will not be too difficult
to get advice on, after all, it's just a form or report to display data.

Tom Ventouris

Bob V said:
Thanks Tom, can you give me your opinion which is best, Drop Down Combo Box
or a Report?
All I am using it for is to see what charges and how much they where for
reference only, so I can what I have charged before.
Does one take longer to load, and which is the more Stable/Suitable?
Thanks for your help....Bob

Tom Ventouris said:
Apologies for the repetition, I kept receiving a "fail" message.
Note the correction:
Select Case Me![ComboBoxName]


Tom Ventouris said:
If you must have 4 reports, rather than one with code to pass parameters,
try
this:

Assigne descriptive names to your reports, for the user, and put these in
the ComboBox Value List.

In the Combo Box After Update Event:

Select Case Me![ComboBoxName}
Case is = "DescriptiveName"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
Case is = "Next Descriptive Name"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
and so on.....
End select


:



How do I go about setting my Combo Box to open any one of my ten
reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob
 
J

John W. Vinson

Thanks Tom, can you give me your opinion which is best, Drop Down Combo Box
or a Report?

Which is the best tool: a Phillips head screwdriver or a table saw?

A combo box and a report are utterly different and not substitutes for one
another.
All I am using it for is to see what charges and how much they where for
reference only, so I can what I have charged before.

Then use a Subform, I'd say. That's an excellent tool to display the current
state of data in a table.

John W. Vinson [MVP]
 
T

Tom Ventouris

Hi Bob

You are missing good advice from Mr Vinson, an MVP for good reason in my
experience and opinion, throughout this thread. The answer to your last post
is yes, with possibly some modification. It seems you are at risk of crowding
your form with uncessary fields and code/functions which will come back to
haunt you later.

It is starting to sound like you are using the wrong tools (combo boxes) for
the right job.

Post, in detail, exactly what you want accomplish for a detailed response
and direction to the right tools.

Tom Ventouris

Bob V said:
Tom Could you use a Dropdown Combo List to open Combos Like these two Combos
Similar to opening Reports?...thanks for the help...Bob

Me.cmbCharge1Y.Requery
Me.cmbCharge1Y.SetFocus
Me.cmbCharge1Y.Dropdown

Me.CmbCharge2Y.Requery
Me.CmbCharge2Y.SetFocus
Me.CmbCharge2Y.Dropdown

Tom Ventouris said:
Apologies for the repetition, I kept receiving a "fail" message.
Note the correction:
Select Case Me![ComboBoxName]


Tom Ventouris said:
If you must have 4 reports, rather than one with code to pass parameters,
try
this:

Assigne descriptive names to your reports, for the user, and put these in
the ComboBox Value List.

In the Combo Box After Update Event:

Select Case Me![ComboBoxName}
Case is = "DescriptiveName"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
Case is = "Next Descriptive Name"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
and so on.....
End select


:



How do I go about setting my Combo Box to open any one of my ten
reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob
 
B

Bob V

I have a table tblAdditionalCharge that has around 1330 records in it now
the table has 7 fields, the 3 fields in my query
DayNo,AdittionalCharge,AdditionalChargeAmount
What I am trying to do is get my query to >Date()-360 on DayNo
and [AdittionalCharge,AdditionalChargeAmount] to be unique

SELECT DISTINCT tblAdditionCharge.AdditionCharge,
tblAdditionCharge.AdditionChargeAmount, tblAdditionCharge.DayNo
FROM tblAdditionCharge INNER JOIN tblHorseInfo ON tblAdditionCharge.HorseID
= tblHorseInfo.HorseID
WHERE (((tblAdditionCharge.AdditionChargeAmount) Is Not Null))
ORDER BY tblAdditionCharge.AdditionCharge;


Then I wanted a drop down list that had names in it that I can enter into
such as "veterinary" so any record that had the word "veterinary" in
AdditionCharge would show the records, A table would hold the words that I
want to search for or add words to or delete out
Is this possible to do and what procedure should I adopt, the record are
just for viewing when accessing a new charge amount

Thanks for any help...........Bob

Tom Ventouris said:
Hi Bob

You are missing good advice from Mr Vinson, an MVP for good reason in my
experience and opinion, throughout this thread. The answer to your last
post
is yes, with possibly some modification. It seems you are at risk of
crowding
your form with uncessary fields and code/functions which will come back to
haunt you later.

It is starting to sound like you are using the wrong tools (combo boxes)
for
the right job.

Post, in detail, exactly what you want accomplish for a detailed response
and direction to the right tools.

Tom Ventouris

Bob V said:
Tom Could you use a Dropdown Combo List to open Combos Like these two
Combos
Similar to opening Reports?...thanks for the help...Bob

Me.cmbCharge1Y.Requery
Me.cmbCharge1Y.SetFocus
Me.cmbCharge1Y.Dropdown

Me.CmbCharge2Y.Requery
Me.CmbCharge2Y.SetFocus
Me.CmbCharge2Y.Dropdown

Tom Ventouris said:
Apologies for the repetition, I kept receiving a "fail" message.
Note the correction:
Select Case Me![ComboBoxName]


:

If you must have 4 reports, rather than one with code to pass
parameters,
try
this:

Assigne descriptive names to your reports, for the user, and put these
in
the ComboBox Value List.

In the Combo Box After Update Event:

Select Case Me![ComboBoxName}
Case is = "DescriptiveName"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
Case is = "Next Descriptive Name"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
and so on.....
End select


:



How do I go about setting my Combo Box to open any one of my ten
reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob
 
T

Tom Ventouris

For this you need a comco box.

Make sure the Wizard is enabled and Place an unbound combo box on your form.
Select the option to "find a record that matches the control" and follow the
wizard prompts.

Alternatively, an unboud combo box with the row source set to the field
containg the key word and code in the Adterupdate event to open the records
that contain the keyword.

Both options are commonly used for finding records on a form. I think the
code is already in this thread, or a quick serch will find it in this group.

Hope this does it.

Bob V said:
I have a table tblAdditionalCharge that has around 1330 records in it now
the table has 7 fields, the 3 fields in my query
DayNo,AdittionalCharge,AdditionalChargeAmount
What I am trying to do is get my query to >Date()-360 on DayNo
and [AdittionalCharge,AdditionalChargeAmount] to be unique

SELECT DISTINCT tblAdditionCharge.AdditionCharge,
tblAdditionCharge.AdditionChargeAmount, tblAdditionCharge.DayNo
FROM tblAdditionCharge INNER JOIN tblHorseInfo ON tblAdditionCharge.HorseID
= tblHorseInfo.HorseID
WHERE (((tblAdditionCharge.AdditionChargeAmount) Is Not Null))
ORDER BY tblAdditionCharge.AdditionCharge;


Then I wanted a drop down list that had names in it that I can enter into
such as "veterinary" so any record that had the word "veterinary" in
AdditionCharge would show the records, A table would hold the words that I
want to search for or add words to or delete out
Is this possible to do and what procedure should I adopt, the record are
just for viewing when accessing a new charge amount

Thanks for any help...........Bob

Tom Ventouris said:
Hi Bob

You are missing good advice from Mr Vinson, an MVP for good reason in my
experience and opinion, throughout this thread. The answer to your last
post
is yes, with possibly some modification. It seems you are at risk of
crowding
your form with uncessary fields and code/functions which will come back to
haunt you later.

It is starting to sound like you are using the wrong tools (combo boxes)
for
the right job.

Post, in detail, exactly what you want accomplish for a detailed response
and direction to the right tools.

Tom Ventouris

Bob V said:
Tom Could you use a Dropdown Combo List to open Combos Like these two
Combos
Similar to opening Reports?...thanks for the help...Bob

Me.cmbCharge1Y.Requery
Me.cmbCharge1Y.SetFocus
Me.cmbCharge1Y.Dropdown

Me.CmbCharge2Y.Requery
Me.CmbCharge2Y.SetFocus
Me.CmbCharge2Y.Dropdown

Apologies for the repetition, I kept receiving a "fail" message.
Note the correction:
Select Case Me![ComboBoxName]


:

If you must have 4 reports, rather than one with code to pass
parameters,
try
this:

Assigne descriptive names to your reports, for the user, and put these
in
the ComboBox Value List.

In the Combo Box After Update Event:

Select Case Me![ComboBoxName}
Case is = "DescriptiveName"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
Case is = "Next Descriptive Name"
DoCmd.OpenReport "rptReportName", acViewPreview, "", "", acNormal
and so on.....
End select


:



How do I go about setting my Combo Box to open any one of my ten
reports
i.e.: rptCharge1.....................rptCharge10
Do I put there name in the Row Source Value [Value List]
Row Source ;rptCharge1;
What would have the Event OnClick
Thanks for any Help....Bob
 
Top