Compile Error: Label Not Defined

O

Olu Solaru

I have a form that has the following command buttons, submit, retry, close,
and combo boxes.

After selecting my options from the combo box, and hit the submit button, I
get the following error message: Compile Error - Label not defined.

I have looked at my coding and can't seem to find anything wrong.

Here is my code:
Private Sub cmdSubmit_Click()
On Error GoTo Err_cmdsubmit_Click
Dim rstOrder As ADODB.Recordset
Set rstOrder = New ADODB.Recordset

rstOrder.Open "tblBprNumber", CurrentProject.Connection, adOpenStatic,
adLockOptimistic
If rstOrder.Supports(adAddNew) Then
With rstOrder
.AddNew
.Fields("BprNumber") = txtBPRNumber
.Fields("LotNumber") = txtLotNumber
.Fields("Sop1") = cboSop1
.Fields("Sop2") = cboSop2
.Fields("Sop3") = cboSop3
.Fields("Sop4") = cboSop4
.Fields("Sop5") = cboSop5
.Fields("Sop6") = cboSop6
.Fields("Sop7") = cboSop7
.Fields("Sop8") = cboSop8
.Fields("Sop9") = cboSop9
.Fields("Sop10") = cboSop10
.Fields("Sop11") = cboSop11
.Fields("Sop12") = cboSop12
.Fields("Sop13") = cboSop13
.Fields("Sop14") = cboSop14
.Fields("Sop15") = cboSop15
.Fields("Sop16") = cboSop16
.Update
cmdReset_Click
End With
End If

rstOrder.Close
Set rstOrder = Nothing

DoCmd.Close

Exit_cmbSubmit_Click:
Exit Sub

Err_cmbSubmit_Click:
MsgBox Err.Description
Resume Exit_cmbSubmit_Click

End Sub
 
O

Olu Solaru

I have figured out my own problem. i changed the following line -
Err_cmbSubmit_Click to Err_cmdSubmit_Click.

But now I have another problem. It does not populate all the fields in the
table , meaning one field value is blank in the new record, and places the
missing field value in the next row. How can I get around this?
 
R

Robert Morley

Everything in your code looks okay at a glance. Is it possible a new record
is being added somehow by cmdReset?


Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top