If Then question

  • Thread starter Thread starter scharp1n2
  • Start date Start date
S

scharp1n2

My if then statement below works great, except if it was true then false ( as
in error) it deletes the entire field. What am I missing? Thanks in advance.
Dim MyDesc As String

MyDesc = [WorkDescription]

If Me.PermitBox = True Then
Me.WorkDescription = MyDesc & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = MyDesc
End If
 
In what event do you have that code running?

You really should have

MyDesc = Me.WorkDescription

although to be honest, I don't see why you wouldn't just use:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription
End If

Of course, changing to False shouldn't actually do anything to the
description if you've already added the " Electrical Permit Included" to
it...
 
On click is the event

If you check the box the 'Electrical Permit Included" appears after the
existing text. If you then decide to uncheck it the entire work description
field is gone including the original description plus the electrical permit
part is gone.

Douglas J. Steele said:
In what event do you have that code running?

You really should have

MyDesc = Me.WorkDescription

although to be honest, I don't see why you wouldn't just use:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription
End If

Of course, changing to False shouldn't actually do anything to the
description if you've already added the " Electrical Permit Included" to
it...


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


scharp1n2 said:
My if then statement below works great, except if it was true then false
( as
in error) it deletes the entire field. What am I missing? Thanks in
advance.
Dim MyDesc As String

MyDesc = [WorkDescription]

If Me.PermitBox = True Then
Me.WorkDescription = MyDesc & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = MyDesc
End If
 
Is there any code associated with the checkbox that's resetting the
description?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scharp1n2 said:
On click is the event

If you check the box the 'Electrical Permit Included" appears after the
existing text. If you then decide to uncheck it the entire work
description
field is gone including the original description plus the electrical
permit
part is gone.

Douglas J. Steele said:
In what event do you have that code running?

You really should have

MyDesc = Me.WorkDescription

although to be honest, I don't see why you wouldn't just use:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit
Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription
End If

Of course, changing to False shouldn't actually do anything to the
description if you've already added the " Electrical Permit Included" to
it...


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


scharp1n2 said:
My if then statement below works great, except if it was true then
false
( as
in error) it deletes the entire field. What am I missing? Thanks in
advance.
Dim MyDesc As String

MyDesc = [WorkDescription]

If Me.PermitBox = True Then
Me.WorkDescription = MyDesc & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = MyDesc
End If
 
Not that I am aware of - where would I look? Thank you so much for your help.

Douglas J. Steele said:
Is there any code associated with the checkbox that's resetting the
description?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scharp1n2 said:
On click is the event

If you check the box the 'Electrical Permit Included" appears after the
existing text. If you then decide to uncheck it the entire work
description
field is gone including the original description plus the electrical
permit
part is gone.

Douglas J. Steele said:
In what event do you have that code running?

You really should have

MyDesc = Me.WorkDescription

although to be honest, I don't see why you wouldn't just use:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit
Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription
End If

Of course, changing to False shouldn't actually do anything to the
description if you've already added the " Electrical Permit Included" to
it...


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


My if then statement below works great, except if it was true then
false
( as
in error) it deletes the entire field. What am I missing? Thanks in
advance.
Dim MyDesc As String

MyDesc = [WorkDescription]

If Me.PermitBox = True Then
Me.WorkDescription = MyDesc & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = MyDesc
End If
 
With the form open in design view, look at the Properties window. Make sure
the checkbox is the active control when looking at the properties. Are there
any values for any of the properties on the Event tab? If the value is
[Event Procedure], click on the ellipsis (...) to the right of the property
to see the code. Otherwise, the value for the property is either the name of
a macro, or the name of a function.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scharp1n2 said:
Not that I am aware of - where would I look? Thank you so much for your
help.

Douglas J. Steele said:
Is there any code associated with the checkbox that's resetting the
description?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scharp1n2 said:
On click is the event

If you check the box the 'Electrical Permit Included" appears after the
existing text. If you then decide to uncheck it the entire work
description
field is gone including the original description plus the electrical
permit
part is gone.

:

In what event do you have that code running?

You really should have

MyDesc = Me.WorkDescription

although to be honest, I don't see why you wouldn't just use:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit
Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription
End If

Of course, changing to False shouldn't actually do anything to the
description if you've already added the " Electrical Permit Included"
to
it...


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


My if then statement below works great, except if it was true then
false
( as
in error) it deletes the entire field. What am I missing? Thanks in
advance.
Dim MyDesc As String

MyDesc = [WorkDescription]

If Me.PermitBox = True Then
Me.WorkDescription = MyDesc & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = MyDesc
End If
 
The only value on the event tab is the on click event which is the following
code:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription

End If

Thanks again,

Douglas J. Steele said:
With the form open in design view, look at the Properties window. Make sure
the checkbox is the active control when looking at the properties. Are there
any values for any of the properties on the Event tab? If the value is
[Event Procedure], click on the ellipsis (...) to the right of the property
to see the code. Otherwise, the value for the property is either the name of
a macro, or the name of a function.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scharp1n2 said:
Not that I am aware of - where would I look? Thank you so much for your
help.

Douglas J. Steele said:
Is there any code associated with the checkbox that's resetting the
description?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


On click is the event

If you check the box the 'Electrical Permit Included" appears after the
existing text. If you then decide to uncheck it the entire work
description
field is gone including the original description plus the electrical
permit
part is gone.

:

In what event do you have that code running?

You really should have

MyDesc = Me.WorkDescription

although to be honest, I don't see why you wouldn't just use:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit
Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription
End If

Of course, changing to False shouldn't actually do anything to the
description if you've already added the " Electrical Permit Included"
to
it...


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


My if then statement below works great, except if it was true then
false
( as
in error) it deletes the entire field. What am I missing? Thanks in
advance.
Dim MyDesc As String

MyDesc = [WorkDescription]

If Me.PermitBox = True Then
Me.WorkDescription = MyDesc & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = MyDesc
End If
 
Then I'm afraid I can't see any reason why WorkDescription would be blanked
out.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scharp1n2 said:
The only value on the event tab is the on click event which is the
following
code:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit
Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription

End If

Thanks again,

Douglas J. Steele said:
With the form open in design view, look at the Properties window. Make
sure
the checkbox is the active control when looking at the properties. Are
there
any values for any of the properties on the Event tab? If the value is
[Event Procedure], click on the ellipsis (...) to the right of the
property
to see the code. Otherwise, the value for the property is either the name
of
a macro, or the name of a function.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scharp1n2 said:
Not that I am aware of - where would I look? Thank you so much for your
help.

:

Is there any code associated with the checkbox that's resetting the
description?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


On click is the event

If you check the box the 'Electrical Permit Included" appears after
the
existing text. If you then decide to uncheck it the entire work
description
field is gone including the original description plus the electrical
permit
part is gone.

:

In what event do you have that code running?

You really should have

MyDesc = Me.WorkDescription

although to be honest, I don't see why you wouldn't just use:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit
Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription
End If

Of course, changing to False shouldn't actually do anything to the
description if you've already added the " Electrical Permit
Included"
to
it...


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


My if then statement below works great, except if it was true
then
false
( as
in error) it deletes the entire field. What am I missing? Thanks
in
advance.
Dim MyDesc As String

MyDesc = [WorkDescription]

If Me.PermitBox = True Then
Me.WorkDescription = MyDesc & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = MyDesc
End If
 
thank you for your time - i will keep trying

Douglas J. Steele said:
Then I'm afraid I can't see any reason why WorkDescription would be blanked
out.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scharp1n2 said:
The only value on the event tab is the on click event which is the
following
code:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit
Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription

End If

Thanks again,

Douglas J. Steele said:
With the form open in design view, look at the Properties window. Make
sure
the checkbox is the active control when looking at the properties. Are
there
any values for any of the properties on the Event tab? If the value is
[Event Procedure], click on the ellipsis (...) to the right of the
property
to see the code. Otherwise, the value for the property is either the name
of
a macro, or the name of a function.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Not that I am aware of - where would I look? Thank you so much for your
help.

:

Is there any code associated with the checkbox that's resetting the
description?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


On click is the event

If you check the box the 'Electrical Permit Included" appears after
the
existing text. If you then decide to uncheck it the entire work
description
field is gone including the original description plus the electrical
permit
part is gone.

:

In what event do you have that code running?

You really should have

MyDesc = Me.WorkDescription

although to be honest, I don't see why you wouldn't just use:

If Me.PermitBox = True Then
Me.WorkDescription = Me.WorkDescription & " Electrical Permit
Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = Me.WorkDescription
End If

Of course, changing to False shouldn't actually do anything to the
description if you've already added the " Electrical Permit
Included"
to
it...


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


My if then statement below works great, except if it was true
then
false
( as
in error) it deletes the entire field. What am I missing? Thanks
in
advance.
Dim MyDesc As String

MyDesc = [WorkDescription]

If Me.PermitBox = True Then
Me.WorkDescription = MyDesc & " Electrical Permit Included"
ElseIf Me.PermitBox = False Then
Me.WorkDescription = MyDesc
End If
 
Back
Top