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




Reply With Quote