Add some stuff to code

G

Guest

I have this code
Private Sub chkApproved_Click()
If Me.chkapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=, Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If

If Me.chknotapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has not been approved.
Pls contact me at your earliest convince." & " " & "Thx Lewis",
EditMessage:=False
End If

If Me.chkapproved = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], , False
DoCmd.PrintOut
DoCmd.Close
End If

End Sub

I have the two check boxes. Travel Approved and Revised. When a supervisor
checks Travel Approved then It send an email to the traveler and to me.
However If the box Revised is checked which is automatically done when they
revise there trip. I would Like the Email to read a little differently. I
do I add this step?
I would like the email to the Traveler to be something around the lines of
"Your revision to [Desination] on [Date Leave] has been approved.

and the one sent to me to say something like [First and Last Name]'s trip
to [Destination] on [Date Leave] has been revised and approved. Please fix
changes made.




Thanks
Chey
 
G

Guest

Hi Chey,

If I am reading you right then a nested if statement should help.

If Me.chkapproved = True Then
If Me.chkrevised = True Then
' DoStuff where both chkboxes =true
Else
' DoStuff where chkapproved=true and chkrevised=false
End if
Else
' DoStuff where chkapproved=false
End if

Nest as many conditions as you like, but be aware that it can give a bit of
brain strain if to many are nested.

Hope it helps.

Regards,
Nick.
 
G

Guest

so I did everything you said and when I went to go run it it says block end
without end if.

Private Sub chkApproved_Click()
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.SendObject acSendNoObject, , , to:=, Subject:=[TA
Number], MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your
REVISED travel to " & [Destination] & " on " & [Date Leave] & " " & "has been
approved.", EditMessage:=True
Else
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "REVISED has been approved please make the following
changes.", EditMessage:=False
DoCmd.PrintOut
DoCmd.Close
Else
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "has been approved please book travel.", False
DoCmd.PrintOut
DoCmd.Close
End If
End Sub

Thanks for your time.

[QUOTE="Biz Enhancer"]
Hi Chey,

If I am reading you right then a nested if statement should help.

If Me.chkapproved = True Then
If Me.chkrevised = True Then
' DoStuff where both chkboxes =true
Else
' DoStuff where chkapproved=true and chkrevised=false
End if
Else
' DoStuff where chkapproved=false
End if

Nest as many conditions as you like, but be aware that it can give a bit of
brain strain if to many are nested.

Hope it helps.

Regards,
Nick.

[QUOTE="Chey"]
I have this code
Private Sub chkApproved_Click()
If Me.chkapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If

If Me.chknotapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has not been approved.
Pls contact me at your earliest convince." & " " & "Thx Lewis",
EditMessage:=False
End If

If Me.chkapproved = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], , False
DoCmd.PrintOut
DoCmd.Close
End If

End Sub

I have the two check boxes. Travel Approved and Revised. When a supervisor
checks Travel Approved then It send an email to the traveler and to me.
However If the box Revised is checked which is automatically done when they
revise there trip. I would Like the Email to read a little differently. I
do I add this step?
I would like the email to the Traveler to be something around the lines of
"Your revision to [Desination] on [Date Leave] has been approved.

and the one sent to me to say something like [First and Last Name]'s trip
to [Destination] on [Date Leave] has been revised and approved. Please fix
changes made.




Thanks
Chey[/QUOTE][/QUOTE]
 
G

Guest

Hy Chey,

I notice from your code that you have more "If" stmts than "Endif"s. It
helps if you indent your "If" stmts by a tab length and keep your "endif"s at
the same tab as your "if"s. The probelem then becomes obvious. As Biz
Enhancer said earlier nested ifs can be a brain buster but if you can lay
your code out then it becomes easier. - eg:-

If XXXX=YYYY Then
If AAAA <> BBBB Then
do something
go somewhere
endif
If CCCC = DDDD Then
do something
endif
do something
endif

Hope this helps


Chey said:
so I did everything you said and when I went to go run it it says block end
without end if.

Private Sub chkApproved_Click()
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.SendObject acSendNoObject, , , to:=, Subject:=[TA
Number], MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your
REVISED travel to " & [Destination] & " on " & [Date Leave] & " " & "has been
approved.", EditMessage:=True
Else
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "REVISED has been approved please make the following
changes.", EditMessage:=False
DoCmd.PrintOut
DoCmd.Close
Else
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "has been approved please book travel.", False
DoCmd.PrintOut
DoCmd.Close
End If
End Sub

Thanks for your time.

[QUOTE="Biz Enhancer"]
Hi Chey,

If I am reading you right then a nested if statement should help.

If Me.chkapproved = True Then
If Me.chkrevised = True Then
' DoStuff where both chkboxes =true
Else
' DoStuff where chkapproved=true and chkrevised=false
End if
Else
' DoStuff where chkapproved=false
End if

Nest as many conditions as you like, but be aware that it can give a bit of
brain strain if to many are nested.

Hope it helps.

Regards,
Nick.

[QUOTE="Chey"]
I have this code
Private Sub chkApproved_Click()
If Me.chkapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If

If Me.chknotapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has not been approved.
Pls contact me at your earliest convince." & " " & "Thx Lewis",
EditMessage:=False
End If

If Me.chkapproved = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], , False
DoCmd.PrintOut
DoCmd.Close
End If

End Sub

I have the two check boxes. Travel Approved and Revised. When a supervisor
checks Travel Approved then It send an email to the traveler and to me.
However If the box Revised is checked which is automatically done when they
revise there trip. I would Like the Email to read a little differently. I
do I add this step?
I would like the email to the Traveler to be something around the lines of
"Your revision to [Desination] on [Date Leave] has been approved.

and the one sent to me to say something like [First and Last Name]'s trip
to [Destination] on [Date Leave] has been revised and approved. Please fix
changes made.




Thanks
Chey[/QUOTE][/QUOTE][/QUOTE]
 
G

Guest

Hi Chey,

You need to add another "End If" after the two "End If"s that are already
present.

For every "If" you must have an "End If", unless you use an "ElseIf"
statement but we don't need to go there yet.

hope it helps.

Regards,
Nick.

Chey said:
so I did everything you said and when I went to go run it it says block end
without end if.

Private Sub chkApproved_Click()
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.SendObject acSendNoObject, , , to:=, Subject:=[TA
Number], MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your
REVISED travel to " & [Destination] & " on " & [Date Leave] & " " & "has been
approved.", EditMessage:=True
Else
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "REVISED has been approved please make the following
changes.", EditMessage:=False
DoCmd.PrintOut
DoCmd.Close
Else
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "has been approved please book travel.", False
DoCmd.PrintOut
DoCmd.Close
End If
End Sub

Thanks for your time.

[QUOTE="Biz Enhancer"]
Hi Chey,

If I am reading you right then a nested if statement should help.

If Me.chkapproved = True Then
If Me.chkrevised = True Then
' DoStuff where both chkboxes =true
Else
' DoStuff where chkapproved=true and chkrevised=false
End if
Else
' DoStuff where chkapproved=false
End if

Nest as many conditions as you like, but be aware that it can give a bit of
brain strain if to many are nested.

Hope it helps.

Regards,
Nick.

[QUOTE="Chey"]
I have this code
Private Sub chkApproved_Click()
If Me.chkapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If

If Me.chknotapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has not been approved.
Pls contact me at your earliest convince." & " " & "Thx Lewis",
EditMessage:=False
End If

If Me.chkapproved = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], , False
DoCmd.PrintOut
DoCmd.Close
End If

End Sub

I have the two check boxes. Travel Approved and Revised. When a supervisor
checks Travel Approved then It send an email to the traveler and to me.
However If the box Revised is checked which is automatically done when they
revise there trip. I would Like the Email to read a little differently. I
do I add this step?
I would like the email to the Traveler to be something around the lines of
"Your revision to [Desination] on [Date Leave] has been approved.

and the one sent to me to say something like [First and Last Name]'s trip
to [Destination] on [Date Leave] has been revised and approved. Please fix
changes made.




Thanks
Chey[/QUOTE][/QUOTE][/QUOTE]
 
G

Guest

unfortunantly I still don't understand. Where am I missing the endif?
I copied and pasted what he gave me.

Thanks
Chey

rogereverest said:
Hy Chey,

I notice from your code that you have more "If" stmts than "Endif"s. It
helps if you indent your "If" stmts by a tab length and keep your "endif"s at
the same tab as your "if"s. The probelem then becomes obvious. As Biz
Enhancer said earlier nested ifs can be a brain buster but if you can lay
your code out then it becomes easier. - eg:-

If XXXX=YYYY Then
If AAAA <> BBBB Then
do something
go somewhere
endif
If CCCC = DDDD Then
do something
endif
do something
endif

Hope this helps


Chey said:
so I did everything you said and when I went to go run it it says block end
without end if.

Private Sub chkApproved_Click()
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.SendObject acSendNoObject, , , to:=, Subject:=[TA
Number], MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your
REVISED travel to " & [Destination] & " on " & [Date Leave] & " " & "has been
approved.", EditMessage:=True
Else
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "REVISED has been approved please make the following
changes.", EditMessage:=False
DoCmd.PrintOut
DoCmd.Close
Else
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "has been approved please book travel.", False
DoCmd.PrintOut
DoCmd.Close
End If
End Sub

Thanks for your time.

[QUOTE="Biz Enhancer"]
Hi Chey,

If I am reading you right then a nested if statement should help.

If Me.chkapproved = True Then
If Me.chkrevised = True Then
' DoStuff where both chkboxes =true
Else
' DoStuff where chkapproved=true and chkrevised=false
End if
Else
' DoStuff where chkapproved=false
End if

Nest as many conditions as you like, but be aware that it can give a bit of
brain strain if to many are nested.

Hope it helps.

Regards,
Nick.

:

I have this code
Private Sub chkApproved_Click()
If Me.chkapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If

If Me.chknotapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has not been approved.
Pls contact me at your earliest convince." & " " & "Thx Lewis",
EditMessage:=False
End If

If Me.chkapproved = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], , False
DoCmd.PrintOut
DoCmd.Close
End If

End Sub

I have the two check boxes. Travel Approved and Revised. When a supervisor
checks Travel Approved then It send an email to the traveler and to me.
However If the box Revised is checked which is automatically done when they
revise there trip. I would Like the Email to read a little differently. I
do I add this step?
I would like the email to the Traveler to be something around the lines of
"Your revision to [Desination] on [Date Leave] has been approved.

and the one sent to me to say something like [First and Last Name]'s trip
to [Destination] on [Date Leave] has been revised and approved. Please fix
changes made.




Thanks
Chey[/QUOTE][/QUOTE][/QUOTE]
 
G

Guest

Hi Chey,

Try this.

Private Sub chkApproved_Click()
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.SendObject acSendNoObject, , , to:=, Subject:=[TA
Number], MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your
REVISED travel to " & [Destination] & " on " & [Date Leave] & " " & "has been
approved.", EditMessage:=True
Else
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If
End IF
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "REVISED has been approved please make the following
changes.", EditMessage:=False
DoCmd.PrintOut
DoCmd.Close
Else
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "has been approved please book travel.", False
DoCmd.PrintOut
DoCmd.Close
End If
End If
End Sub


[QUOTE="Chey"]
unfortunantly I still don't understand. Where am I missing the endif?
I copied and pasted what he gave me.

Thanks
Chey

[QUOTE="rogereverest"]
Hy Chey,

I notice from your code that you have more "If" stmts than "Endif"s. It
helps if you indent your "If" stmts by a tab length and keep your "endif"s at
the same tab as your "if"s. The probelem then becomes obvious. As Biz
Enhancer said earlier nested ifs can be a brain buster but if you can lay
your code out then it becomes easier. - eg:-

If XXXX=YYYY Then
If AAAA <> BBBB Then
do something
go somewhere
endif
If CCCC = DDDD Then
do something
endif
do something
endif

Hope this helps


[QUOTE="Chey"]
so I did everything you said and when I went to go run it it says block end
without end if.

Private Sub chkApproved_Click()
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA
Number], MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your
REVISED travel to " & [Destination] & " on " & [Date Leave] & " " & "has been
approved.", EditMessage:=True
Else
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "REVISED has been approved please make the following
changes.", EditMessage:=False
DoCmd.PrintOut
DoCmd.Close
Else
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "has been approved please book travel.", False
DoCmd.PrintOut
DoCmd.Close
End If
End Sub

Thanks for your time.

:

Hi Chey,

If I am reading you right then a nested if statement should help.

If Me.chkapproved = True Then
If Me.chkrevised = True Then
' DoStuff where both chkboxes =true
Else
' DoStuff where chkapproved=true and chkrevised=false
End if
Else
' DoStuff where chkapproved=false
End if

Nest as many conditions as you like, but be aware that it can give a bit of
brain strain if to many are nested.

Hope it helps.

Regards,
Nick.

:

I have this code
Private Sub chkApproved_Click()
If Me.chkapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If

If Me.chknotapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has not been approved.
Pls contact me at your earliest convince." & " " & "Thx Lewis",
EditMessage:=False
End If

If Me.chkapproved = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], , False
DoCmd.PrintOut
DoCmd.Close
End If

End Sub

I have the two check boxes. Travel Approved and Revised. When a supervisor
checks Travel Approved then It send an email to the traveler and to me.
However If the box Revised is checked which is automatically done when they
revise there trip. I would Like the Email to read a little differently. I
do I add this step?
I would like the email to the Traveler to be something around the lines of
"Your revision to [Desination] on [Date Leave] has been approved.

and the one sent to me to say something like [First and Last Name]'s trip
to [Destination] on [Date Leave] has been revised and approved. Please fix
changes made.




Thanks
Chey[/QUOTE][/QUOTE][/QUOTE]
 
G

Guest

Thanks I got it to work.
I wasn't thinking when I did that last post

Biz Enhancer said:
Hi Chey,

You need to add another "End If" after the two "End If"s that are already
present.

For every "If" you must have an "End If", unless you use an "ElseIf"
statement but we don't need to go there yet.

hope it helps.

Regards,
Nick.

Chey said:
so I did everything you said and when I went to go run it it says block end
without end if.

Private Sub chkApproved_Click()
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.SendObject acSendNoObject, , , to:=, Subject:=[TA
Number], MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your
REVISED travel to " & [Destination] & " on " & [Date Leave] & " " & "has been
approved.", EditMessage:=True
Else
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If
If Me.chkapproved = True Then
If Me.Revised = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "REVISED has been approved please make the following
changes.", EditMessage:=False
DoCmd.PrintOut
DoCmd.Close
Else
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], [First and Last Names] & "'s" & " " & "trip to" & " "
& [Destination] & " " & "has been approved please book travel.", False
DoCmd.PrintOut
DoCmd.Close
End If
End Sub

Thanks for your time.

[QUOTE="Biz Enhancer"]
Hi Chey,

If I am reading you right then a nested if statement should help.

If Me.chkapproved = True Then
If Me.chkrevised = True Then
' DoStuff where both chkboxes =true
Else
' DoStuff where chkapproved=true and chkrevised=false
End if
Else
' DoStuff where chkapproved=false
End if

Nest as many conditions as you like, but be aware that it can give a bit of
brain strain if to many are nested.

Hope it helps.

Regards,
Nick.

:

I have this code
Private Sub chkApproved_Click()
If Me.chkapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has been approved.",
EditMessage:=False
End If

If Me.chknotapproved = True Then
DoCmd.SendObject acSendNoObject, , , to:=[Email], Subject:=[TA Number],
MessageText:="Dear " & [First and Last Name] & ", " & vbCrLf & "Your travel
to " & [Destination] & " on " & [Date Leave] & " " & "has not been approved.
Pls contact me at your earliest convince." & " " & "Thx Lewis",
EditMessage:=False
End If

If Me.chkapproved = True Then
DoCmd.OpenReport "Travel Request 0 Layover", acViewPreview, , "[TA
Numbers.TA Number]=[Forms]![Appoved]![TA Number]"
DoCmd.SendObject acSendReport, "Travel Request 0 Layover", acFormatSNP,
[Request Given to Email], , , "Travel Approved" & " " & [TA Number] & " " &
[First and Last Name], , False
DoCmd.PrintOut
DoCmd.Close
End If

End Sub

I have the two check boxes. Travel Approved and Revised. When a supervisor
checks Travel Approved then It send an email to the traveler and to me.
However If the box Revised is checked which is automatically done when they
revise there trip. I would Like the Email to read a little differently. I
do I add this step?
I would like the email to the Traveler to be something around the lines of
"Your revision to [Desination] on [Date Leave] has been approved.

and the one sent to me to say something like [First and Last Name]'s trip
to [Destination] on [Date Leave] has been revised and approved. Please fix
changes made.




Thanks
Chey[/QUOTE][/QUOTE][/QUOTE]
 

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

Similar Threads

Email in access 4
go to 2
Email in Access 5
email in access 2
Private Sub not working on main form 1
Modifying a Form to append the resulting email's subject line 0
Add to text box String 4
Email a record 2

Top