Report selection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to have a form where I can select a report from the growing list I am
creating which are just held in the reports objects. Probably want to do this
from a combo box??
how can I do this please?
 
To list all reports in your combo, set its RowSource to:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32764)
AND ([Name] Not Like "~*")
AND ([Name] Not Like "MSys*"))
ORDER BY [Name];

More info:
List Box of Available Reports
at:
http://allenbrowne.com/ser-19.html
 
Mmmm thats fine and it works if I put in :

DoCmd.OpenReport Me!CmbSelectReport, acViewPreview

in the AfterUpdate of my combo box. One slight quibble ; when I next go into
the form its displaying the last report I selected. Idealy it should allways
refresh to the top of the list or better still show empty?

Allen Browne said:
To list all reports in your combo, set its RowSource to:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32764)
AND ([Name] Not Like "~*")
AND ([Name] Not Like "MSys*"))
ORDER BY [Name];

More info:
List Box of Available Reports
at:
http://allenbrowne.com/ser-19.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

martyn said:
I want to have a form where I can select a report from the growing list I
am
creating which are just held in the reports objects. Probably want to do
this
from a combo box??
how can I do this please?
 
The form will open without any value chosen in the combo if the combo is
unbound and has nothing in its DefaultValue.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

martyn said:
Mmmm thats fine and it works if I put in :

DoCmd.OpenReport Me!CmbSelectReport, acViewPreview

in the AfterUpdate of my combo box. One slight quibble ; when I next go
into
the form its displaying the last report I selected. Idealy it should
allways
refresh to the top of the list or better still show empty?

Allen Browne said:
To list all reports in your combo, set its RowSource to:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32764)
AND ([Name] Not Like "~*")
AND ([Name] Not Like "MSys*"))
ORDER BY [Name];

More info:
List Box of Available Reports
at:
http://allenbrowne.com/ser-19.html

martyn said:
I want to have a form where I can select a report from the growing list
I
am
creating which are just held in the reports objects. Probably want to
do
this
from a combo box??
how can I do this please?
 
mmm no sorry but the combo is unbound and Default value is indeed clear -
weird!
When the report is closed and form viewed the report previously selected is
shown. Not a real issue just doent look good?
Any more thoughts?

Allen Browne said:
The form will open without any value chosen in the combo if the combo is
unbound and has nothing in its DefaultValue.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

martyn said:
Mmmm thats fine and it works if I put in :

DoCmd.OpenReport Me!CmbSelectReport, acViewPreview

in the AfterUpdate of my combo box. One slight quibble ; when I next go
into
the form its displaying the last report I selected. Idealy it should
allways
refresh to the top of the list or better still show empty?

Allen Browne said:
To list all reports in your combo, set its RowSource to:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32764)
AND ([Name] Not Like "~*")
AND ([Name] Not Like "MSys*"))
ORDER BY [Name];

More info:
List Box of Available Reports
at:
http://allenbrowne.com/ser-19.html

I want to have a form where I can select a report from the growing list
I
am
creating which are just held in the reports objects. Probably want to
do
this
from a combo box??
how can I do this please?
 
Assign Null to the combo in whatever event suits you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

martyn said:
mmm no sorry but the combo is unbound and Default value is indeed clear -
weird!
When the report is closed and form viewed the report previously selected
is
shown. Not a real issue just doent look good?
Any more thoughts?

Allen Browne said:
The form will open without any value chosen in the combo if the combo is
unbound and has nothing in its DefaultValue.

martyn said:
Mmmm thats fine and it works if I put in :

DoCmd.OpenReport Me!CmbSelectReport, acViewPreview

in the AfterUpdate of my combo box. One slight quibble ; when I next go
into
the form its displaying the last report I selected. Idealy it should
allways
refresh to the top of the list or better still show empty?

:

To list all reports in your combo, set its RowSource to:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32764)
AND ([Name] Not Like "~*")
AND ([Name] Not Like "MSys*"))
ORDER BY [Name];

More info:
List Box of Available Reports
at:
http://allenbrowne.com/ser-19.html

I want to have a form where I can select a report from the growing
list
I
am
creating which are just held in the reports objects. Probably want
to
do
this
from a combo box??
how can I do this please?
 
Now you have lost me So for instance in the OnLostFocus event which I think
would work(?) how could I assign a null value there??

Confused now

Allen Browne said:
Assign Null to the combo in whatever event suits you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

martyn said:
mmm no sorry but the combo is unbound and Default value is indeed clear -
weird!
When the report is closed and form viewed the report previously selected
is
shown. Not a real issue just doent look good?
Any more thoughts?

Allen Browne said:
The form will open without any value chosen in the combo if the combo is
unbound and has nothing in its DefaultValue.

Mmmm thats fine and it works if I put in :

DoCmd.OpenReport Me!CmbSelectReport, acViewPreview

in the AfterUpdate of my combo box. One slight quibble ; when I next go
into
the form its displaying the last report I selected. Idealy it should
allways
refresh to the top of the list or better still show empty?

:

To list all reports in your combo, set its RowSource to:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32764)
AND ([Name] Not Like "~*")
AND ([Name] Not Like "MSys*"))
ORDER BY [Name];

More info:
List Box of Available Reports
at:
http://allenbrowne.com/ser-19.html

I want to have a form where I can select a report from the growing
list
I
am
creating which are just held in the reports objects. Probably want
to
do
this
from a combo box??
how can I do this please?
 
Pardon me, but if the form remains open, then the value doesn't change
(unless you do something to reset it)

In the code you are running after your code that opens the report, you
should be able to set the combobox's value to null.

I'm sure that Allen Browne can tell you exactly where to put the code change
if you decide to post the code that you are using to call the report.


martyn said:
Now you have lost me So for instance in the OnLostFocus event which I
think
would work(?) how could I assign a null value there??

Confused now

Allen Browne said:
Assign Null to the combo in whatever event suits you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

martyn said:
mmm no sorry but the combo is unbound and Default value is indeed
clear -
weird!
When the report is closed and form viewed the report previously
selected
is
shown. Not a real issue just doent look good?
Any more thoughts?

:

The form will open without any value chosen in the combo if the combo
is
unbound and has nothing in its DefaultValue.

Mmmm thats fine and it works if I put in :

DoCmd.OpenReport Me!CmbSelectReport, acViewPreview

in the AfterUpdate of my combo box. One slight quibble ; when I next
go
into
the form its displaying the last report I selected. Idealy it should
allways
refresh to the top of the list or better still show empty?

:

To list all reports in your combo, set its RowSource to:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32764)
AND ([Name] Not Like "~*")
AND ([Name] Not Like "MSys*"))
ORDER BY [Name];

More info:
List Box of Available Reports
at:
http://allenbrowne.com/ser-19.html

I want to have a form where I can select a report from the growing
list
I
am
creating which are just held in the reports objects. Probably
want
to
do
this
from a combo box??
how can I do this please?
 
Agreed, as you can see Alan gave me the code and I do understand I need to
reset the form by setting the combo box to null but dont know how to do this
and await somebodys help

ta

John Spencer said:
Pardon me, but if the form remains open, then the value doesn't change
(unless you do something to reset it)

In the code you are running after your code that opens the report, you
should be able to set the combobox's value to null.

I'm sure that Allen Browne can tell you exactly where to put the code change
if you decide to post the code that you are using to call the report.


martyn said:
Now you have lost me So for instance in the OnLostFocus event which I
think
would work(?) how could I assign a null value there??

Confused now

Allen Browne said:
Assign Null to the combo in whatever event suits you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

mmm no sorry but the combo is unbound and Default value is indeed
clear -
weird!
When the report is closed and form viewed the report previously
selected
is
shown. Not a real issue just doent look good?
Any more thoughts?

:

The form will open without any value chosen in the combo if the combo
is
unbound and has nothing in its DefaultValue.

Mmmm thats fine and it works if I put in :

DoCmd.OpenReport Me!CmbSelectReport, acViewPreview

in the AfterUpdate of my combo box. One slight quibble ; when I next
go
into
the form its displaying the last report I selected. Idealy it should
allways
refresh to the top of the list or better still show empty?

:

To list all reports in your combo, set its RowSource to:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32764)
AND ([Name] Not Like "~*")
AND ([Name] Not Like "MSys*"))
ORDER BY [Name];

More info:
List Box of Available Reports
at:
http://allenbrowne.com/ser-19.html

I want to have a form where I can select a report from the growing
list
I
am
creating which are just held in the reports objects. Probably
want
to
do
this
from a combo box??
how can I do this please?
 
I repeat. Post YOUR code. Allen Browne gave you code to populate the list
box. I don't see code from him that actually calls the report. I would
guess that you have code that does that either in the update event of the
combobox or in the click event of a button on the same form as the combobox.
If so, post that code.

I would guess you have code that looks something like

DoCmd.OpenReport Me.lstReports, acViewPreview

Right after that you would add a line, something like
Me.lstReports = null


martyn said:
Agreed, as you can see Alan gave me the code and I do understand I need to
reset the form by setting the combo box to null but dont know how to do
this
and await somebodys help

ta

John Spencer said:
Pardon me, but if the form remains open, then the value doesn't change
(unless you do something to reset it)

In the code you are running after your code that opens the report, you
should be able to set the combobox's value to null.

I'm sure that Allen Browne can tell you exactly where to put the code
change
if you decide to post the code that you are using to call the report.


martyn said:
Now you have lost me So for instance in the OnLostFocus event which I
think
would work(?) how could I assign a null value there??

Confused now

:

Assign Null to the combo in whatever event suits you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

mmm no sorry but the combo is unbound and Default value is indeed
clear -
weird!
When the report is closed and form viewed the report previously
selected
is
shown. Not a real issue just doent look good?
Any more thoughts?

:

The form will open without any value chosen in the combo if the
combo
is
unbound and has nothing in its DefaultValue.

Mmmm thats fine and it works if I put in :

DoCmd.OpenReport Me!CmbSelectReport, acViewPreview

in the AfterUpdate of my combo box. One slight quibble ; when I
next
go
into
the form its displaying the last report I selected. Idealy it
should
allways
refresh to the top of the list or better still show empty?

:

To list all reports in your combo, set its RowSource to:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32764)
AND ([Name] Not Like "~*")
AND ([Name] Not Like "MSys*"))
ORDER BY [Name];

More info:
List Box of Available Reports
at:
http://allenbrowne.com/ser-19.html

I want to have a form where I can select a report from the
growing
list
I
am
creating which are just held in the reports objects. Probably
want
to
do
this
from a combo box??
how can I do this please?
 
I have

Private Sub CmbSelectReport_AfterUpdate()
DoCmd.OpenReport Me!CmbSelectReport, acViewPreview
End Sub

and in my row source

SELECT MSysObjects.Name FROM MSysObjects WHERE (((Left([Name],1))<>"~") AND
((Left([Name],4))<>"rsub") AND ((MSysObjects.Type)=-32764)) ORDER BY
MSysObjects.Name;

<>rsub - this will prevent sub reports showing on list as this is my naming
convention

Once the report is picked from the combo box is picked it should be cleared

much appreciate your help




John Spencer said:
I repeat. Post YOUR code. Allen Browne gave you code to populate the list
box. I don't see code from him that actually calls the report. I would
guess that you have code that does that either in the update event of the
combobox or in the click event of a button on the same form as the combobox.
If so, post that code.

I would guess you have code that looks something like

DoCmd.OpenReport Me.lstReports, acViewPreview

Right after that you would add a line, something like
Me.lstReports = null


martyn said:
Agreed, as you can see Alan gave me the code and I do understand I need to
reset the form by setting the combo box to null but dont know how to do
this
and await somebodys help

ta

John Spencer said:
Pardon me, but if the form remains open, then the value doesn't change
(unless you do something to reset it)

In the code you are running after your code that opens the report, you
should be able to set the combobox's value to null.

I'm sure that Allen Browne can tell you exactly where to put the code
change
if you decide to post the code that you are using to call the report.


Now you have lost me So for instance in the OnLostFocus event which I
think
would work(?) how could I assign a null value there??

Confused now

:

Assign Null to the combo in whatever event suits you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

mmm no sorry but the combo is unbound and Default value is indeed
clear -
weird!
When the report is closed and form viewed the report previously
selected
is
shown. Not a real issue just doent look good?
Any more thoughts?

:

The form will open without any value chosen in the combo if the
combo
is
unbound and has nothing in its DefaultValue.

Mmmm thats fine and it works if I put in :

DoCmd.OpenReport Me!CmbSelectReport, acViewPreview

in the AfterUpdate of my combo box. One slight quibble ; when I
next
go
into
the form its displaying the last report I selected. Idealy it
should
allways
refresh to the top of the list or better still show empty?

:

To list all reports in your combo, set its RowSource to:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32764)
AND ([Name] Not Like "~*")
AND ([Name] Not Like "MSys*"))
ORDER BY [Name];

More info:
List Box of Available Reports
at:
http://allenbrowne.com/ser-19.html

I want to have a form where I can select a report from the
growing
list
I
am
creating which are just held in the reports objects. Probably
want
to
do
this
from a combo box??
how can I do this please?
 
Try:

Private Sub CmbSelectReport_AfterUpdate()
DoCmd.OpenReport Me!CmbSelectReport, acViewPreview
Me!CmbSelectReport = Null
End Sub
 
Back
Top