If Else Lack of knowledge (1 Viewer)

Marinus

I'm learning... :)
Local time
Today, 17:34
Joined
Jun 16, 2010
Messages
140
Hi Guys, making great progress thanks to all your help here, however on other question arises;

In a simple way I have a user print a payment slip using a command_button "Docket_Payment", it is protected with a password question, when the user pressed on the button, and gives the right password he is presented with a preview of the report "Payment".

Now I would like to add to the code that if the same button is pressed a different report "Sale" is presented when the checkbox "Sale" is ticked.

I do not know how to get there, to many If Else or other methodology for my knowledge...

Hope someone can help me out..

here is the code I have;

Private Sub Docket_payment_Click()
Dim strPasswd

strPasswd = InputBox("Enter Password", "Restricted Form")

If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
End If


If strPasswd = "154" Then
Dim strDocName As String
Dim strWhere As String
strDocName = "Payment"
strWhere = "[Docket_Number]=" & Me!Docket_Number
DoCmd.OpenReport strDocName, acPreview, , strWhere
Me.Paid = -1
Else
MsgBox "Sorry, you do not have access to this form", _
vbOKOnly, "Important Information"
Exit Sub
End If
End Sub
 

DCrake

Remembered
Local time
Today, 17:34
Joined
Jun 8, 2005
Messages
8,632
Code:
If Me.CheckBox = True then
     strDocName = "Sale"
Else
     strDocName = "Payment"
End If
 

Marinus

I'm learning... :)
Local time
Today, 17:34
Joined
Jun 16, 2010
Messages
140
Thanks David, I was on it trace, didn't know where to place it, your code did the job..
 

Users who are viewing this thread

Top Bottom