Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Case Problem 2

Status
Not open for further replies.

rj51cxa

Technical User
Mar 16, 2006
216
GB
I have a report which lists winners of a competition (txtUnit) in the order of their scores (position), with Position 4 being the highest score and Position 1 the lowest. A label (lblPlacing) shows either "Winner" or "Second Place" depending on the position. The problem is compounded by the requirement to show teams that competed for Honours Only (lblHO), who are not entitled to win the trophy.

The following code is in the On Print event of the Detail Section:
Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

Select Case Position
Case 4
    Select Case Honours_Only
    Case True
        lblPlacing.Caption = "Actual Winner"
        LblHO.Visible = True
    Case Else
        lblPlacing.Caption = "Winner"
        LblHO.Visible = False
    'Select Case TxtUnit
    'Case Nz(TxtUnit)
        'lblPlacing.Visible = False
        'LblHO.Visible = False
        'Case Else
        'lblPlacing.Visible = True
        'LblHO.Visible = True
    'End Select
    End Select
Case 3
    Select Case Honours_Only
    Case True
        lblPlacing.Caption = "Actual Second Place"
        LblHO.Visible = True
    Case Else
        lblPlacing.Caption = "Second Place"
        LblHO.Visible = False
    'Select Case TxtUnit
    'Case Nz(TxtUnit)
        'lblPlacing.Visible = False
        'LblHO.Visible = False
    'Case Else
        'lblPlacing.Visible = True
        'LblHO.Visible = True
        'lblPlacing.Caption = "Winner"
    'End Select
    End Select
Case 2
Select Case Honours_Only
    Case True
        lblPlacing.Caption = ""
        LblHO.Visible = True
    Case Else
        lblPlacing.Caption = "Second Place"
        LblHO.Visible = False
    'Select Case TxtUnit
    'Case Nz(TxtUnit)
        'lblPlacing.Visible = False
        'LblHO.Visible = False
    'Case Else
        'lblPlacing.Visible = True
        'LblHO.Visible = True
        'lblPlacing.Caption = "Second Place"
    'End Select
    End Select
End Select
End Sub

My problem is that, under certain conditions, only three scores are shown and, therefore, Position 4 becomes blank.
I therefore need Case 4 to be ignored and the parameters for Case 4 to be used in Case 3.

What I am trying to achieve with the Select Case TxtUnit is to say that, if TxtUnit is null, then nothing is printed, otherwise the Position and Honours Only labels are visible.

The first part of the code works well but, as you can see, I have had to rem out all reference to the Select Case because this effectively makes lblPlacing invisible for all cases. I think the problem is with "Case Nz(txtUnit)" for which I am not sure if my syntax is correct.

Any ideas would be most welcome
Best Regards
John
 
Duane,

I changed the name in "ModPlacing" and left ModBusinessCode as it was. I placed a text box in the report but I got the Mirosoft Jet engine message again, saying that "Positon" was not recognised. I changed it to "IntPosition" but no difference.

I'm sorry to be a pain but I seem to be going round in circles here. I'm afraid I can't see the wood for the trees.

Best Regards
John
 
This expression as the Control Source of a text box expects you to have fields in your report's record source of Position and Honours_Only.
[tt]
=GetPlace([Position],[Honours_Only])
[/tt]
Your original post contained:
Code:
Select Case Position
Case 4
    Select Case Honours_Only
This suggested you had a field bound in your report named "Position".

Duane
Hook'D on Access
MS Access MVP
 
Well done Duane, I think you deserve two stars for all the time and patience you have given me.

I had a field in the report called Place which I had changed to txtPlace when I was trying to sort things out. I changed it back to position and everything worked. Now all I have to do is to sort out one more problem with the Select Case coding and the job is done.

I think it will be better to start a new thread as this one is far too long anyway.

Thanks very much for all your help, I really do appreciate it.

Ray,
Thanks for you help and for taking an interest in my problem. I realise now how very limited my knowledge is.

Best regards
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top