Help Please Combo Box Used to Select a Report

D

Dermot

I have created........
A table of contacts "tblContactDetails"
A Query "qryContactDetails"
A Query qryParameterSurname
A Report "rptQueryParameterSurname2"
A form with a 2 column ( First / Last Name) combo box in it "cboCantactNames"

Questions
1. I can anyone advise me how I get a contacts details report to be
displayed when I click on a contacts name in the drop down list in the combo
box.

2. Do I need to use VBA to do this, can you post a "commented" example
please that I could examine.

3. Any other tips relevant would be appreciated.

It was suggested I build a query that uses the combo box as criteria.....
[Forms]![The name of my Form]![MyComboBox]
But I did not know where I was meant to enter these details....are they
combo box properties, Query field Properties, which field?
Any help would be great.
Thanks

Thanks
 
O

Ofer

On the After update event of the combo box you can write the command line
that open the report, with a Where condition in the name

Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!cboCantactNames.column(0) & "' AND [Last Name] = '" &
MyRec!cboCantactNames.column(1) & "'"

Assuming that the First name is the first column, and the Last Name is the
second column in the combo, if that is not the case change the column numbers.
 
D

Dermot

Hi Ofer,
Thanks for the reply
Can you advise further please?

I have entered the afterupdate event procedure as you described.
I had to change the name of the combobox.

Private Sub Combo7_AfterUpdate()
Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!Combo7.column(0) & "' AND [Last Name] = '" &
MyRec!Combo7.Column (1) & "'"
End Sub

The whole DoCmd statement is in "Red Text" except for the second last line
.....MyRec!Combo7.Column(1)&"'" which is in black text..........what does
the red text mean?

When I click on the combo box, I get the 2 column list of names, but when I
select a name, only the "Surname" appears in the combo box window and the
report doesn't open.

Thanks
Dermot

Ofer said:
On the After update event of the combo box you can write the command line
that open the report, with a Where condition in the name

Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!cboCantactNames.column(0) & "' AND [Last Name] = '" &
MyRec!cboCantactNames.column(1) & "'"

Assuming that the First name is the first column, and the Last Name is the
second column in the combo, if that is not the case change the column numbers.
--
I hope that helped
Good luck


Dermot said:
I have created........
A table of contacts "tblContactDetails"
A Query "qryContactDetails"
A Query qryParameterSurname
A Report "rptQueryParameterSurname2"
A form with a 2 column ( First / Last Name) combo box in it "cboCantactNames"

Questions
1. I can anyone advise me how I get a contacts details report to be
displayed when I click on a contacts name in the drop down list in the combo
box.

2. Do I need to use VBA to do this, can you post a "commented" example
please that I could examine.

3. Any other tips relevant would be appreciated.

It was suggested I build a query that uses the combo box as criteria.....
[Forms]![The name of my Form]![MyComboBox]
But I did not know where I was meant to enter these details....are they
combo box properties, Query field Properties, which field?
Any help would be great.
Thanks

Thanks
 
O

Ofer

There is probably an Enter Chr in the end of each line.
Go to the end of each line and press delete to bring the following line to
the prev line

It doesn't metter that only one value displayed in the combo, Access will
still recognise both column.
--
I hope that helped
Good luck


Dermot said:
Hi Ofer,
Thanks for the reply
Can you advise further please?

I have entered the afterupdate event procedure as you described.
I had to change the name of the combobox.

Private Sub Combo7_AfterUpdate()
Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!Combo7.column(0) & "' AND [Last Name] = '" &
MyRec!Combo7.Column (1) & "'"
End Sub

The whole DoCmd statement is in "Red Text" except for the second last line
....MyRec!Combo7.Column(1)&"'" which is in black text..........what does
the red text mean?

When I click on the combo box, I get the 2 column list of names, but when I
select a name, only the "Surname" appears in the combo box window and the
report doesn't open.

Thanks
Dermot

Ofer said:
On the After update event of the combo box you can write the command line
that open the report, with a Where condition in the name

Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!cboCantactNames.column(0) & "' AND [Last Name] = '" &
MyRec!cboCantactNames.column(1) & "'"

Assuming that the First name is the first column, and the Last Name is the
second column in the combo, if that is not the case change the column numbers.
--
I hope that helped
Good luck


Dermot said:
I have created........
A table of contacts "tblContactDetails"
A Query "qryContactDetails"
A Query qryParameterSurname
A Report "rptQueryParameterSurname2"
A form with a 2 column ( First / Last Name) combo box in it "cboCantactNames"

Questions
1. I can anyone advise me how I get a contacts details report to be
displayed when I click on a contacts name in the drop down list in the combo
box.

2. Do I need to use VBA to do this, can you post a "commented" example
please that I could examine.

3. Any other tips relevant would be appreciated.

It was suggested I build a query that uses the combo box as criteria.....
[Forms]![The name of my Form]![MyComboBox]
But I did not know where I was meant to enter these details....are they
combo box properties, Query field Properties, which field?
Any help would be great.
Thanks

Thanks
 
D

Dermot

Hi Ofer,
Thanks for the reply.
I have eliminated the "End of line Enters" and no longer have the red text.
When I click on a combo box entery in the list, it still won't open the
report.
I have checked the report name and it is definately correct.
It is the "After Update Event" I am supposed to be using?
Have you any other suggestions?
Thanks
Dermot


Ofer said:
There is probably an Enter Chr in the end of each line.
Go to the end of each line and press delete to bring the following line to
the prev line

It doesn't metter that only one value displayed in the combo, Access will
still recognise both column.
--
I hope that helped
Good luck


Dermot said:
Hi Ofer,
Thanks for the reply
Can you advise further please?

I have entered the afterupdate event procedure as you described.
I had to change the name of the combobox.

Private Sub Combo7_AfterUpdate()
Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!Combo7.column(0) & "' AND [Last Name] = '" &
MyRec!Combo7.Column (1) & "'"
End Sub

The whole DoCmd statement is in "Red Text" except for the second last line
....MyRec!Combo7.Column(1)&"'" which is in black text..........what does
the red text mean?

When I click on the combo box, I get the 2 column list of names, but when I
select a name, only the "Surname" appears in the combo box window and the
report doesn't open.

Thanks
Dermot

Ofer said:
On the After update event of the combo box you can write the command line
that open the report, with a Where condition in the name

Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!cboCantactNames.column(0) & "' AND [Last Name] = '" &
MyRec!cboCantactNames.column(1) & "'"

Assuming that the First name is the first column, and the Last Name is the
second column in the combo, if that is not the case change the column numbers.
--
I hope that helped
Good luck


:

I have created........
A table of contacts "tblContactDetails"
A Query "qryContactDetails"
A Query qryParameterSurname
A Report "rptQueryParameterSurname2"
A form with a 2 column ( First / Last Name) combo box in it "cboCantactNames"

Questions
1. I can anyone advise me how I get a contacts details report to be
displayed when I click on a contacts name in the drop down list in the combo
box.

2. Do I need to use VBA to do this, can you post a "commented" example
please that I could examine.

3. Any other tips relevant would be appreciated.

It was suggested I build a query that uses the combo box as criteria.....
[Forms]![The name of my Form]![MyComboBox]
But I did not know where I was meant to enter these details....are they
combo box properties, Query field Properties, which field?
Any help would be great.
Thanks

Thanks
 
O

Ofer

You mantioned something about changing the name of the combo, if you did then
the sub is not connected any more to the combo, you'll have to define it
again.
Just in case, put a code break in the first line of the code (press F9) and
check if the code stop when you select a value in the combo, if it doesn't,
then check the properties of the combo, if you have the sub declare there.

--
I hope that helped
Good luck


Dermot said:
Hi Ofer,
Thanks for the reply.
I have eliminated the "End of line Enters" and no longer have the red text.
When I click on a combo box entery in the list, it still won't open the
report.
I have checked the report name and it is definately correct.
It is the "After Update Event" I am supposed to be using?
Have you any other suggestions?
Thanks
Dermot


Ofer said:
There is probably an Enter Chr in the end of each line.
Go to the end of each line and press delete to bring the following line to
the prev line

It doesn't metter that only one value displayed in the combo, Access will
still recognise both column.
--
I hope that helped
Good luck


Dermot said:
Hi Ofer,
Thanks for the reply
Can you advise further please?

I have entered the afterupdate event procedure as you described.
I had to change the name of the combobox.

Private Sub Combo7_AfterUpdate()
Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!Combo7.column(0) & "' AND [Last Name] = '" &
MyRec!Combo7.Column (1) & "'"
End Sub

The whole DoCmd statement is in "Red Text" except for the second last line
....MyRec!Combo7.Column(1)&"'" which is in black text..........what does
the red text mean?

When I click on the combo box, I get the 2 column list of names, but when I
select a name, only the "Surname" appears in the combo box window and the
report doesn't open.

Thanks
Dermot

:

On the After update event of the combo box you can write the command line
that open the report, with a Where condition in the name

Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!cboCantactNames.column(0) & "' AND [Last Name] = '" &
MyRec!cboCantactNames.column(1) & "'"

Assuming that the First name is the first column, and the Last Name is the
second column in the combo, if that is not the case change the column numbers.
--
I hope that helped
Good luck


:

I have created........
A table of contacts "tblContactDetails"
A Query "qryContactDetails"
A Query qryParameterSurname
A Report "rptQueryParameterSurname2"
A form with a 2 column ( First / Last Name) combo box in it "cboCantactNames"

Questions
1. I can anyone advise me how I get a contacts details report to be
displayed when I click on a contacts name in the drop down list in the combo
box.

2. Do I need to use VBA to do this, can you post a "commented" example
please that I could examine.

3. Any other tips relevant would be appreciated.

It was suggested I build a query that uses the combo box as criteria.....
[Forms]![The name of my Form]![MyComboBox]
But I did not know where I was meant to enter these details....are they
combo box properties, Query field Properties, which field?
Any help would be great.
Thanks

Thanks
 
D

Dermot

Thanks again Ofer,
I had given the wrong name to the combo box in my first posting, the correct
name was Combo7.
I still can't figure out how the code should work Ofer.
I really want to figure out how to do this but I realise VBA is complex.
I thought if I keep things as simple as possible I might work it out.
I chose this function fro a combo box because I would use it if I could get
it to work.
Thanks
Dermot

Ofer said:
You mantioned something about changing the name of the combo, if you did then
the sub is not connected any more to the combo, you'll have to define it
again.
Just in case, put a code break in the first line of the code (press F9) and
check if the code stop when you select a value in the combo, if it doesn't,
then check the properties of the combo, if you have the sub declare there.

--
I hope that helped
Good luck


Dermot said:
Hi Ofer,
Thanks for the reply.
I have eliminated the "End of line Enters" and no longer have the red text.
When I click on a combo box entery in the list, it still won't open the
report.
I have checked the report name and it is definately correct.
It is the "After Update Event" I am supposed to be using?
Have you any other suggestions?
Thanks
Dermot


Ofer said:
There is probably an Enter Chr in the end of each line.
Go to the end of each line and press delete to bring the following line to
the prev line

It doesn't metter that only one value displayed in the combo, Access will
still recognise both column.
--
I hope that helped
Good luck


:

Hi Ofer,
Thanks for the reply
Can you advise further please?

I have entered the afterupdate event procedure as you described.
I had to change the name of the combobox.

Private Sub Combo7_AfterUpdate()
Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!Combo7.column(0) & "' AND [Last Name] = '" &
MyRec!Combo7.Column (1) & "'"
End Sub

The whole DoCmd statement is in "Red Text" except for the second last line
....MyRec!Combo7.Column(1)&"'" which is in black text..........what does
the red text mean?

When I click on the combo box, I get the 2 column list of names, but when I
select a name, only the "Surname" appears in the combo box window and the
report doesn't open.

Thanks
Dermot

:

On the After update event of the combo box you can write the command line
that open the report, with a Where condition in the name

Docmd.OpenReport "rptQueryParameterSurname2",,,"[First Name]= '" &
MyRec!cboCantactNames.column(0) & "' AND [Last Name] = '" &
MyRec!cboCantactNames.column(1) & "'"

Assuming that the First name is the first column, and the Last Name is the
second column in the combo, if that is not the case change the column numbers.
--
I hope that helped
Good luck


:

I have created........
A table of contacts "tblContactDetails"
A Query "qryContactDetails"
A Query qryParameterSurname
A Report "rptQueryParameterSurname2"
A form with a 2 column ( First / Last Name) combo box in it "cboCantactNames"

Questions
1. I can anyone advise me how I get a contacts details report to be
displayed when I click on a contacts name in the drop down list in the combo
box.

2. Do I need to use VBA to do this, can you post a "commented" example
please that I could examine.

3. Any other tips relevant would be appreciated.

It was suggested I build a query that uses the combo box as criteria.....
[Forms]![The name of my Form]![MyComboBox]
But I did not know where I was meant to enter these details....are they
combo box properties, Query field Properties, which field?
Any help would be great.
Thanks

Thanks
 

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