|
-
Jan 11th, 2003, 09:51 AM
#1
Thread Starter
Lively Member
EndIF without IF
can Anyone find the error here.
I keep on getting the Endif without If error but I cant find the error
Code:
Private Sub cmbpay_Click()
'This proc will run when the client clicks on delivery combobox.
'Once the client selects their option then
'the textboxes will be filled with the details of the required
'credit card option. These textboxes will then be locked.
Dim i As Integer
adodel.RecordSource = "PaymentMethods"
adodel.Refresh
With adodel.Recordset
.MoveFirst
Do While Not .EOF
'If clientID is found and text from combobox matches the data on field CardType
If cmbpay.Text = .Fields("ClientCardType") And .Fields("ClientID") = frmShopWindow.ID Then
txtpay(1).Text = cmbpay.Text
txtpay(2).Text = .Fields("ClientCardNo")
CmbDate(0).Text = GetMonth(Mid$((.Fields("ClientCardStartDate")), 1, 2))
CmbDate(1).Text = Right$(.Fields("ClientCardStartDate"), 4)
CmbDate(2).Text = GetMonth(Mid$((.Fields("ClientCardExpiryDate")), 1, 2))
CmbDate(3).Text = Right$(.Fields("ClientCardExpiryDate"), 4)
DoEvents
If Date > CDate("01/" & GetMonthNumber(CmbDate(0)) & "/" & CmbDate(1)) Then
If Date < CDate("01/" & GetMonthNumber(CmbDate(2)) & "/" & CmbDate(3)) Then
txtpay(2).Enabled = False
Cmdnewpay.Visible = False
cmbpay.Enabled = False
For i = 0 To CmbDate.Count - 1
CmbDate(i).Enabled = False
Next i
If txtdel(2).Enabled = False And txtpay(2).Enabled = False Then CmdFinish.Visible = True
Exit Sub
End If
Else
Call showError(CmbDate(2), "Invalid Expiry Date")
Exit Sub
End If
Else
Call showError(CmbDate(0), "Invalid Start Date")
Exit Sub
End If
End If
.MoveNext
Loop
End With
End Sub
-
Jan 11th, 2003, 09:58 AM
#2
Thread Starter
Lively Member
-
Jan 11th, 2003, 09:59 AM
#3
Frenzied Member
VB Code:
If txtdel(2).Enabled = False And txtpay(2).Enabled = False Then CmdFinish.Visible = True
Exit Sub
End If
by the way, did you know that
for I=1 to 20
Next I
is slower than
for I=1 to 20
Next
?
There are 3 types of people in this world.........those that can count, and those that can't.
Blobby
-
Jan 11th, 2003, 10:01 AM
#4
PowerPoster
the statement
If txtdel(2).Enabled = False And txtpay(2).Enabled = False Then CmdFinish.Visible = True
is selfcontained and does not require (or allow) any "end if" since you've completed the if all on one line.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|