I am trying to create a user form for better data entry at work. When I try to add an entry via the user form, the code fails referencing "Identifier not recognized." However, it only does this for some identifiers.
The identifiers listed below are able to be user entered with no problems. The remainder are not recognized.
Me.txtQty.Value
Me.txtDay.Value
Me.cboPart.Value
Me.cboEmp.Value
Please see below for my code.
Thanks in advance!!
_____________________________________________________
Sub cmdAdd_Click()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Total")
'find first empty row in database
lRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
With ws
.Cells(IRow, 2).Value = Me.txtEntBy.Value
.Cells(lRow, 3).Value = Me.txtDay.Value
.Cells(lRow, 4).Value = Me.cboEmp.Value
.Cells(lRow, 5).Value = Me.cboPart.Value
'.Cells(IRow, 6).Value = Me.txtFuel.Value
'.Cells(IRow, 7).Value = Me.txtOdS.Value
'.Cells(IRow, 8).Value = Me.txtOdE.Value
.Cells(lRow, 10).Value = Me.txtQty.Value
'.Cells(IRow, 11).Value = Me.txtDel.Value
End With
'clear the data
Me.txtEntBy.Value = ""
Me.cboPart.Value = ""
Me.cboEmp.Value = ""
Me.txtDay.Value = Format(Date, "Short Date")
Me.txtQty.Value = 1
Me.txtFuel.Value = ""
Me.txtOdS.Value = ""
Me.txtOdE.Value = ""
Me.txtDel.Value = ""
Me.cboPart.SetFocus
End Sub
The identifiers listed below are able to be user entered with no problems. The remainder are not recognized.
Me.txtQty.Value
Me.txtDay.Value
Me.cboPart.Value
Me.cboEmp.Value
Please see below for my code.
Thanks in advance!!
_____________________________________________________
Sub cmdAdd_Click()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Total")
'find first empty row in database
lRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
With ws
.Cells(IRow, 2).Value = Me.txtEntBy.Value
.Cells(lRow, 3).Value = Me.txtDay.Value
.Cells(lRow, 4).Value = Me.cboEmp.Value
.Cells(lRow, 5).Value = Me.cboPart.Value
'.Cells(IRow, 6).Value = Me.txtFuel.Value
'.Cells(IRow, 7).Value = Me.txtOdS.Value
'.Cells(IRow, 8).Value = Me.txtOdE.Value
.Cells(lRow, 10).Value = Me.txtQty.Value
'.Cells(IRow, 11).Value = Me.txtDel.Value
End With
'clear the data
Me.txtEntBy.Value = ""
Me.cboPart.Value = ""
Me.cboEmp.Value = ""
Me.txtDay.Value = Format(Date, "Short Date")
Me.txtQty.Value = 1
Me.txtFuel.Value = ""
Me.txtOdS.Value = ""
Me.txtOdE.Value = ""
Me.txtDel.Value = ""
Me.cboPart.SetFocus
End Sub