hurtsmyhead
Technical User
- Jun 3, 2010
- 8
Hi All,
First I'll set up the situation. I've got a form with three fields, and the first two determine what is written to the third:
InclDriver: a True/False check box.
DrvPartNum: a text box that data is manually entered into, if there is data.
HidDriver: Text, or text plus the contents of DrvPartNum, is written to this field, depending on whether or not DrvPartNum has any data.
This is the code:
If [InclDriver] = True And [DrvPartNum] <> "" Then
HidDriver = "<li>Driver side airbag - Part #" & Me.DrvPartNum.Value & "</li>"
ElseIf [InclDriver] = True And [DrvPartNum] = "" Then
HidDriver = "<li>Driver side airbag</li>"
Else
HidDriver = "It's not working"
End If
If InclDriver is true (checked) and DrvPartNum is not empty, write a text string and the contents of DrvPartNum to the HidDriver field. If InclDriver is true but DrvPartNum is empty, just write a text string. If any other condition exists, write nothing, or for the time being as I test this, write "It's not working".
The first If statement works fine. The ElseIf statement is not working--when InclDriver is true and DrvPartNum is empty Access is not evaluating the statement as true.
I tried it using Null instead of an empty string value but that didn't work at all. The field in the table is set to Allow Zero Length.
What the heck am I missing? I know this will take one of you experienced folks about 15 seconds. I work nights so I'm going to bed right now (this is late even for me), don't be surprised if you don't see my profuse thanks for another eight or nine hours.
Mark
First I'll set up the situation. I've got a form with three fields, and the first two determine what is written to the third:
InclDriver: a True/False check box.
DrvPartNum: a text box that data is manually entered into, if there is data.
HidDriver: Text, or text plus the contents of DrvPartNum, is written to this field, depending on whether or not DrvPartNum has any data.
This is the code:
If [InclDriver] = True And [DrvPartNum] <> "" Then
HidDriver = "<li>Driver side airbag - Part #" & Me.DrvPartNum.Value & "</li>"
ElseIf [InclDriver] = True And [DrvPartNum] = "" Then
HidDriver = "<li>Driver side airbag</li>"
Else
HidDriver = "It's not working"
End If
If InclDriver is true (checked) and DrvPartNum is not empty, write a text string and the contents of DrvPartNum to the HidDriver field. If InclDriver is true but DrvPartNum is empty, just write a text string. If any other condition exists, write nothing, or for the time being as I test this, write "It's not working".
The first If statement works fine. The ElseIf statement is not working--when InclDriver is true and DrvPartNum is empty Access is not evaluating the statement as true.
I tried it using Null instead of an empty string value but that didn't work at all. The field in the table is set to Allow Zero Length.
What the heck am I missing? I know this will take one of you experienced folks about 15 seconds. I work nights so I'm going to bed right now (this is late even for me), don't be surprised if you don't see my profuse thanks for another eight or nine hours.
Mark