Syntax for If statement in After Update Event

S

Susan L

I currently have an After Update event that fills the subject line on a form
control.

Now I need to add another control [Partner] whose value, if filled, will be
incorporated into the subject line. If it is not filled, the value from
another control [State] will be incorporated. [State] will be the control
that is most often filled, so [Partner] will be the Else.

Here is the current code:

Me![Identifier] = [TicketNum] & " - " & [State] _
& " - " & [ReceivedDate] & " - " & [txtDescriptionText]

I have received errors on the syntax I tried and wonder if someone can help?
 
D

Daryl S

Susan -

Here is the if statement you need to start with:

If IsNull(Me.Partner) Then
Me![Identifier] = [TicketNum] & " - " & [State] _
& " - " & [ReceivedDate] & " - " & [txtDescriptionText] & Me.StateList &
" - " & Me.State
Else
Me![Identifier] = [TicketNum] & " - " & [State] _
& " - " & [ReceivedDate] & " - " & [txtDescriptionText] & Me.StateList &
" - " & Me.Partner
End If
 
B

BruceM via AccessMonster.com

Is [Identifier] an unbound text box? If not, it should be, as the value is
derived entirely from other fields.

There is nothing obvious, but there are not many details. Does the syntax
error arise when compiling the code, or when you try to update the control?
Does the error message provide any details about the error?

BTW, I expect you will need the same code in the form's Current event to
display the appropriate information for the record rather than from the last
time the control was updated.

Susan said:
I currently have an After Update event that fills the subject line on a form
control.

Now I need to add another control [Partner] whose value, if filled, will be
incorporated into the subject line. If it is not filled, the value from
another control [State] will be incorporated. [State] will be the control
that is most often filled, so [Partner] will be the Else.

Here is the current code:

Me![Identifier] = [TicketNum] & " - " & [State] _
& " - " & [ReceivedDate] & " - " & [txtDescriptionText]

I have received errors on the syntax I tried and wonder if someone can help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top