comnetlimited
Technical User
Hi folks,
(Win2000 sp4, Access 2000, MADO 2.7 Library)
Tables: tblCustomers, tableDebtorLedger.
Form: frmNewTransaction
I got a dialog box "Object Required" everytime I click Submit button. I did a control break and it stops at line Resume Exit_cmdSubmit_Click (Refer to code below).
Option Compare Database
Private Sub cmdExit_Click()
DoCmd.Close
End Sub
Private Sub cmdReset_Click()
On Error GoTo Err_cmdReset_Click
cboCustomerId = ""
lblCustomerName = ""
txtLoanAmount = ""
cboCustomerName.SetFocus
Exit_cmdReset_Click:
Exit Sub
Err_cmdReset_Click:
MsgBox Err.Description
Resume Exit_cmdReset_Click
End Sub
Private Sub cmdSubmit_Click()
On Error GoTo Err_cmdSubmit_Click
Dim rstNewLoan As ADODB.Recordset
Set rstNewLoan = New ADODB.Recordset
rstOrder.Open "tblDebtorLedger", CurrentProject.Connection, adOpenStatic, adLockOptimistic
If rstNewLoan.Supports(adAddNew) Then
With rstNewLoan
.AddNew
.Fields("CustomerId") = cboCustomerId
.Fields("CustomerName") = "Testing"
.Fields("LoanAmount") = txtLoanAmount
.Update
cmdReset_Click
End With
End If
rstNewLoan.Close
Set rstNewLoan = Nothing
Exit_cmdSubmit_Click:
Exit Sub
Err_cmdSubmit_Click:
MsgBox Err.Description
Resume Exit_cmdSubmit_Click
End Sub
Am I missing some object or something in the Tools-reference?
Please help.
(Win2000 sp4, Access 2000, MADO 2.7 Library)
Tables: tblCustomers, tableDebtorLedger.
Form: frmNewTransaction
I got a dialog box "Object Required" everytime I click Submit button. I did a control break and it stops at line Resume Exit_cmdSubmit_Click (Refer to code below).
Option Compare Database
Private Sub cmdExit_Click()
DoCmd.Close
End Sub
Private Sub cmdReset_Click()
On Error GoTo Err_cmdReset_Click
cboCustomerId = ""
lblCustomerName = ""
txtLoanAmount = ""
cboCustomerName.SetFocus
Exit_cmdReset_Click:
Exit Sub
Err_cmdReset_Click:
MsgBox Err.Description
Resume Exit_cmdReset_Click
End Sub
Private Sub cmdSubmit_Click()
On Error GoTo Err_cmdSubmit_Click
Dim rstNewLoan As ADODB.Recordset
Set rstNewLoan = New ADODB.Recordset
rstOrder.Open "tblDebtorLedger", CurrentProject.Connection, adOpenStatic, adLockOptimistic
If rstNewLoan.Supports(adAddNew) Then
With rstNewLoan
.AddNew
.Fields("CustomerId") = cboCustomerId
.Fields("CustomerName") = "Testing"
.Fields("LoanAmount") = txtLoanAmount
.Update
cmdReset_Click
End With
End If
rstNewLoan.Close
Set rstNewLoan = Nothing
Exit_cmdSubmit_Click:
Exit Sub
Err_cmdSubmit_Click:
MsgBox Err.Description
Resume Exit_cmdSubmit_Click
End Sub
Am I missing some object or something in the Tools-reference?
Please help.