J
JohnB
Hi.
This should be easy but I can't get it to work.
I have a subform with a command button and the choice of form that it opens
depends on the contents of two fields on the subform. Here is the code I'm
using (it's just the relevant part):
If Me.cboPlacementStage = "PGCE Final" And Me.txtPlacementStartYear >=
"2007" Then
stDocName = "frmGrades3"
Else
stDocName = "frmGrades1"
End If
If Me.cboPlacementStage = "PGCE First" And Me.txtPlacementStartYear
Else
stDocName = "frmGrades1"
End If
I hope you get the idea. The thing is, frmGrades3 is opened correctly when
the lower If, Then, Else, End If block is satisfied but frmGrades1 is opened
in error even though the first block is satisfied. When I cut the lower block
out and paste it above the upper block, the situation is reversed. It seems
that the lower block always opens the correct form, while the upper block
always opens the wrong form, despite the conditions for both blocks being
satisfied. I've obviously put this together wrongly.
Can anyone tell me what's wrong with this approach and also, how do you do
this when you have a whole load of If Then conditions that you need to check
for?
Thanks.
This should be easy but I can't get it to work.
I have a subform with a command button and the choice of form that it opens
depends on the contents of two fields on the subform. Here is the code I'm
using (it's just the relevant part):
If Me.cboPlacementStage = "PGCE Final" And Me.txtPlacementStartYear >=
"2007" Then
stDocName = "frmGrades3"
Else
stDocName = "frmGrades1"
End If
If Me.cboPlacementStage = "PGCE First" And Me.txtPlacementStartYear
stDocName = "frmGrades3"= "2007" Then
Else
stDocName = "frmGrades1"
End If
I hope you get the idea. The thing is, frmGrades3 is opened correctly when
the lower If, Then, Else, End If block is satisfied but frmGrades1 is opened
in error even though the first block is satisfied. When I cut the lower block
out and paste it above the upper block, the situation is reversed. It seems
that the lower block always opens the correct form, while the upper block
always opens the wrong form, despite the conditions for both blocks being
satisfied. I've obviously put this together wrongly.
Can anyone tell me what's wrong with this approach and also, how do you do
this when you have a whole load of If Then conditions that you need to check
for?
Thanks.