if , else if ... then

emanuele

the old good fellow Bill
Local time
Today, 17:53
Joined
Jan 23, 2003
Messages
23
can someone take a look this code? it is not working... : I mean all the simple codes work if I write one by one, but when I write all these "elseIf" I have problems. I understand I do no know how to write it and I need some information about how to use If, else if....then
Anyone can suggest where to find it?
Thanks again for all the support and the help I´ve got just reading all the other topics..


Private SubPrivate Sub Kommandoknapp28_Click()
On Error GoTo Err_Kommandoknapp28_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

If Me.checkin = 0 Then
MsgBox "INSERT CHECK IN DATE"
DoCmd.GoToRecord acDataForm, "checkin", acGoTo, 7

ElseIf Me.Betalningsdatum = 0 Then
MsgBox "INSERT CHECK OUT DATE"
DoCmd.GoToRecord acDataForm, "Betalningsdatum", acGoTo, 7


ElseIf Me.Given_Points >= 10 And Me.status = "1" Then

MsgBox "CONGRATULATIONS!! YOU NOW REACHED SILVER STATUS"

Dim stDocName As String

stDocName = "silver"
DoCmd.OpenReport stDocName, acNormal


ElseIf Me.Given_Points >= 30 And Me.status = "2" Then
MsgBox "CONGRATULATIONS!! YOU NOW REACHED PLATINUM STATUS"

stDocName = "platinum"
DoCmd.OpenReport stDocName, acNormal

End If

DoCmd.Close


Exit_Kommandoknapp28_Click:
Exit Sub

Err_Kommandoknapp28_Click:
MsgBox Err.Description
Resume Exit_Kommandoknapp28_Click

End Sub Kommandoknapp28_Click()
 
Last edited:
Private SubPrivate Sub Kommandoknapp28_Click()
On Error GoTo Err_Kommandoknapp28_Click

Dim stDocName As String

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70


If Me.checkin = 0 or Me.Betalningsdatum = 0 Then
MsgBox "CHECK IN AND CHECK OUT DATES REQUIRED"
DoCmd.GoToRecord acDataForm, "checkin", acGoTo, 7
End if

If Me.Given_Points >= 10 And Me.status = "1" Then
MsgBox "CONGRATULATIONS!! YOU NOW REACHED SILVER STATUS"
stDocName = "silver"
DoCmd.OpenReport stDocName, acNormal

ElseIf Me.Given_Points >= 30 And Me.status = "2" Then
MsgBox "CONGRATULATIONS!! YOU NOW REACHED PLATINUM STATUS"
stDocName = "platinum"
DoCmd.OpenReport stDocName, acNormal
else
Exit Sub
End If

DoCmd.Close


Exit_Kommandoknapp28_Click:
Exit Sub

Err_Kommandoknapp28_Click:
MsgBox Err.Description
Resume Exit_Kommandoknapp28_Click

End Sub Kommandoknapp28_Click()
 
thanks for the help

thanks for your help Mark, I will try it now and hope it will work.
just one question... do you know where on the web I can get informations about how to write codes using if ... else if, as well as information on how to customize msgboxes, I might need it in the future.
cheers,
Emanuele
 
where are you getting hung up? On what line? and what message are you getting?
 
a look at this sample?

If you have time and feel like you want to take a look at this sample I would be grateful. I explain in it what my problem is..
thank you for all the support.
 

Attachments

:confused: no one could give me any suggestion?......

:(
 

Users who are viewing this thread

Back
Top Bottom