How do I set up a selection box from Switchboard to Report?

L

Linda

I hope I can explain this...

I want to have, as a selection on a switchboard - run a certain report. I
can figure that part out. However, when people select this option, I want a
box (or something) to appear where they can set the criteria, based on 4
fields of a query that the report is linked to.

For example, they would select the button that says "Run Land Purchase Record"
Then, A box would appear that lists 4 fields, State, Funding, Project and
Segment. They would then be able to type in the response that would select
this criteria for the report, then the report would print.

Sounds easy and I have a huge reference book to look at now, but I don't
know what this procedure is called!

BTW - do you think Access 2003 Inside/Out is a good reference book to have,
or is there another you would recommend? I also have Access 2003 for Dummies.

Linda
 
D

Duane Hookom

You should place controls on your form that can be used to filter the
report. Then use code to build a where condition and open the report:

Dim strWhere as String
Dim strRptName as String
strWhere = "1=1 "
If Not IsNull(Me.txtState) Then
strWhere = strWhere & " AND [StateField] =""" & Me.txtState & """"
End If
If Not IsNull(Me.txtFunding) Then
'
End If
'more ifs
strRptName = Me.lboReportList
DoCmd.OpenReport strRptName, acPreview, , strWhere

I like John Viescas' new book. Check www.viescas.com.
 
L

Linda

Thanks, Duane, I will try this!

The Inside/Out book is by John Viescas, so I guess I am in good hands.

Linda

Duane Hookom said:
You should place controls on your form that can be used to filter the
report. Then use code to build a where condition and open the report:

Dim strWhere as String
Dim strRptName as String
strWhere = "1=1 "
If Not IsNull(Me.txtState) Then
strWhere = strWhere & " AND [StateField] =""" & Me.txtState & """"
End If
If Not IsNull(Me.txtFunding) Then
'
End If
'more ifs
strRptName = Me.lboReportList
DoCmd.OpenReport strRptName, acPreview, , strWhere

I like John Viescas' new book. Check www.viescas.com.


--
Duane Hookom
MS Access MVP


Linda said:
I hope I can explain this...

I want to have, as a selection on a switchboard - run a certain report. I
can figure that part out. However, when people select this option, I want
a
box (or something) to appear where they can set the criteria, based on 4
fields of a query that the report is linked to.

For example, they would select the button that says "Run Land Purchase
Record"
Then, A box would appear that lists 4 fields, State, Funding, Project and
Segment. They would then be able to type in the response that would
select
this criteria for the report, then the report would print.

Sounds easy and I have a huge reference book to look at now, but I don't
know what this procedure is called!

BTW - do you think Access 2003 Inside/Out is a good reference book to
have,
or is there another you would recommend? I also have Access 2003 for
Dummies.

Linda
 
D

dpoholsky

I'm want to do the same with opening a report on a switchboard but I'm so not
good at writing code, is there another way to do this and get the same
result?? Thanks in advance

Linda said:
Thanks, Duane, I will try this!

The Inside/Out book is by John Viescas, so I guess I am in good hands.

Linda

Duane Hookom said:
You should place controls on your form that can be used to filter the
report. Then use code to build a where condition and open the report:

Dim strWhere as String
Dim strRptName as String
strWhere = "1=1 "
If Not IsNull(Me.txtState) Then
strWhere = strWhere & " AND [StateField] =""" & Me.txtState & """"
End If
If Not IsNull(Me.txtFunding) Then
'
End If
'more ifs
strRptName = Me.lboReportList
DoCmd.OpenReport strRptName, acPreview, , strWhere

I like John Viescas' new book. Check www.viescas.com.


--
Duane Hookom
MS Access MVP


Linda said:
I hope I can explain this...

I want to have, as a selection on a switchboard - run a certain report. I
can figure that part out. However, when people select this option, I want
a
box (or something) to appear where they can set the criteria, based on 4
fields of a query that the report is linked to.

For example, they would select the button that says "Run Land Purchase
Record"
Then, A box would appear that lists 4 fields, State, Funding, Project and
Segment. They would then be able to type in the response that would
select
this criteria for the report, then the report would print.

Sounds easy and I have a huge reference book to look at now, but I don't
know what this procedure is called!

BTW - do you think Access 2003 Inside/Out is a good reference book to
have,
or is there another you would recommend? I also have Access 2003 for
Dummies.

Linda
 

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