if is possible to use an If statement with Select Case

soundsfishy

Registered User.
Local time
Tomorrow, 08:05
Joined
Sep 25, 2002
Messages
174
I want to add to a Message box asking if users want make changes after click an option in an Option Group

I need to incorporate something like this into select case after a selection has been made eg

If Case1 is selected , I need MsgBox to appear asking if the user want to make changes to a report. If Yes then, the DoCmd Open report will be acViewPreview, if user selects No then
DoCmd open report will print as acViewNormal.

I will be using the same method for Case 2 and Case 3.

I not sure how to correctly right this.

I know using just Select Case but not using any IF statements.

Im currently using
Private Sub grpPrint_Click()
Select Case Me!grpReports
Case 1
DoCmd.OpenReport "rptLetter1", acViewPreview, , "[ClientID] = " & Me.ClientID


I hope this is possible
 
Fish,

Code:
Select Case Me!grpReports 
   Case 1 
     If MsgBox("Print Preview", vbQuestion + vbYesNo, "ReprotType") <> vbYes
        DoCmd.OpenReport "rptLetter1", acViewPreview, , "[ClientID] = " & Me.ClientID 
     Else
        DoCmd.OpenReport "rptLetter1", acViewNormal, , "[ClientID] = " & Me.ClientID 
     End If
   Case 2 ...

Wayne
 
perfect! dude..your da man :-)
 
Fish,

Oops.

Not quite, what's a Reprot and the <> should be =.

Wayne
 
no Problems!

I did experience a problem with <> so I changed to = before u notice the problem :-)

While I have your attention and just out of curosity ,is there any way to have the report go directly as a word doc instead of going to acViewPreview. I was hoping that users could avoid having to click the officeLink Icon to covert the report as Word. Its not big deal as my users are used to using this method but if what I ask is achievable, that would be fantastic.
 
Fish,

I don't know, but I'll bet it has to do with:

DoCmd.OutputTo acOutputReport, "YourReport", ...

Wayne
 
Thanks!

I'll have a play with the code and see what happens!

:-)
 
Last edited:
In a Report: I see the ID not the name

I dont know if I should start a new thread! but here goes.!

The report that Im using, I have decided to add an extra text box to show the case office for a record that is being generated using the code you gave me.

The report is base on a query and the data come from tblReferrals.eg type, names, address,ssn, date referred, case officer etc

The combo box cboOfficer is gets is values from a referrece table
tblOfficers
OfficerID
Name
Phone

Bound Column 1
Column Count 3
0cm;2.54cm;2.54cm
SELECT DISTINCTROW tblofficer.OfficerID, tblofficer.ReferringOfficer, tblofficer.PhoneNo FROM tblofficer ORDER BY tblofficer.ReferringOfficer;


I know how to store the name value rather than the ID on a form but why cant I see the name enter on the form in the report . I only see the ID. e.g If the case officer is me it show the value 2 which the index no.
 
Sounds,

Not quite understanding, but the .Column subscripts start at 0.

Wayne
 
Ok. what ive done is added an extra field a report to show who the case officer is that case. The officer name is entered via a form and that information is stored in tblreferrals.

The report gets it data from a query which is based on data stored in tblreferral.

My question is, why is it that the officer name is stored as a name and yet on the report I can only view the ID associated with the name. Shouldnt the field in the report appear whats is displayed in the query data.

does this clarify things
 
Sounds,

Is the name in the query and does it show it?

If it does, does the control source on the report map to the
column in the query that shows the name?

Wayne
 
yep, the name is in the query.

Im not sure what mean?

If it does, does the control source on the report map to the
column in the query that shows the name?
 

Users who are viewing this thread

Back
Top Bottom