adewale4favour
Registered User.
- Local time
- Today, 14:48
- Joined
- Aug 9, 2019
- Messages
- 55
Hi,
I have a project currently in my hand. Two variables are to be checked with If Statements. If the first set of conditions are true, then the code should stop executing, if the first condition is true, then it should proceed to check the second condition. If the second condition is verified, then another bunch of code can continue.
I keep getting a compiler error: "If without Else", and when I reverse the code, "I get Else without If error"
Below is the code, please help if you can
Private Sub Command49_Click()
On Error Resume Next
If Me.ROUTE.Value = "SILO" Then
If IsNull(DLookup("ATC_SILO", "ATC_SILOqry")) Then
MsgBox "The request is currently not available", "No ATC"
Cancel = True
Else
Me.ATC_NO = DLookup("ATC_SILO", "ATC_SILOqry")
DoCmd.Save
DoCmd.SetWarnings False
DoCmd.OpenQuery "qrydeleteupdatedSILO"
DoCmd.SetWarnings True
DoCmd.Close
DoCmd.OpenForm "ATC_UTILIZATION", acNormal
Many thanks in advance
I have a project currently in my hand. Two variables are to be checked with If Statements. If the first set of conditions are true, then the code should stop executing, if the first condition is true, then it should proceed to check the second condition. If the second condition is verified, then another bunch of code can continue.
I keep getting a compiler error: "If without Else", and when I reverse the code, "I get Else without If error"
Below is the code, please help if you can
Private Sub Command49_Click()
On Error Resume Next
If Me.ROUTE.Value = "SILO" Then
If IsNull(DLookup("ATC_SILO", "ATC_SILOqry")) Then
MsgBox "The request is currently not available", "No ATC"
Cancel = True
Else
Me.ATC_NO = DLookup("ATC_SILO", "ATC_SILOqry")
DoCmd.Save
DoCmd.SetWarnings False
DoCmd.OpenQuery "qrydeleteupdatedSILO"
DoCmd.SetWarnings True
DoCmd.Close
DoCmd.OpenForm "ATC_UTILIZATION", acNormal
Many thanks in advance