Help with visual basic code

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

Guest

I have a form that has 2 options on it...one is carry out, the other is drive
thru. On this same form, there are 2 sections for cleanliness of the
resteraunt...one details outside the building (drive thru), the other details
the inside of the building (carry out). The form assumes a score of 100%,
and subtracts ONLY if an item is selected. (it passes a value of 1 for the
appropriate field...has a default value of 0 otherwise.) Everything works
fine except I am running into a problem with my reporting for the outside /
inside questions...reason being is they really shouldn't get outside
questions deducted for inside shops, and vise versa. also, they shouldn't
get rewareded with 100% for that section if it was n/a. So, here is what I
really want to have happen:

On my frame entitled FrameCarryOutDrivethru, I have two options: theya are
optCarryOut which passes 0 as a value if selected, and optDriveThru which
passes 1 if selected into the field CarryOutDriveThru. If optCarryOut is
selected, then I want the default value for C1ParkingLot and C1Sidewalks to
be null and C2Floors to be 0. I want the default value to be those numbers
or null so they can deduct if need be. Passing a null will cause my avg
function to work properly as it skips null on the count. Would the code look
something like this?

If optCarryOut=True Then
C1ParkingLot=Null
C1Sidewalks=Null
C2Floors=0
Else
C1ParkingLot=0
C1Sidewalks=0
C2Floors=Null
End If

Would that allow everything to work? I knwo that actual code doesn't...but
is it something similar to this? Thanks!
 
I have a form that has 2 options on it...one is carry out, the other is drive
thru. On this same form, there are 2 sections for cleanliness of the
resteraunt...one details outside the building (drive thru), the other details
the inside of the building (carry out). The form assumes a score of 100%,
and subtracts ONLY if an item is selected. (it passes a value of 1 for the
appropriate field...has a default value of 0 otherwise.) Everything works
fine except I am running into a problem with my reporting for the outside /
inside questions...reason being is they really shouldn't get outside
questions deducted for inside shops, and vise versa. also, they shouldn't
get rewareded with 100% for that section if it was n/a. So, here is what I
really want to have happen:

On my frame entitled FrameCarryOutDrivethru, I have two options: theya are
optCarryOut which passes 0 as a value if selected, and optDriveThru which
passes 1 if selected into the field CarryOutDriveThru. If optCarryOut is
selected, then I want the default value for C1ParkingLot and C1Sidewalks to
be null and C2Floors to be 0. I want the default value to be those numbers
or null so they can deduct if need be. Passing a null will cause my avg
function to work properly as it skips null on the count. Would the code look
something like this?

If optCarryOut=True Then
C1ParkingLot=Null
C1Sidewalks=Null
C2Floors=0
Else
C1ParkingLot=0
C1Sidewalks=0
C2Floors=Null
End If

Would that allow everything to work? I knwo that actual code doesn't...but
is it something similar to this? Thanks!


Not sure I followed all that, but the logic seems sensible.
The only issues I see in your code is that it appears you
are testing the option in the frame when you should be
checking the frame' value. The Frame control would have a
value of 0 when the carryout option is selected.

Again, I'm not sure, but I think you want:

If Me.FrameCarryOutDrivethru = 0 Then
 
Back
Top