My code:
Private Sub SubmitButton_Click()
Dim LastName As String, FirstName As String, DrugName As String
Dim DateRec As Date
Dim FullName As String
Dim DrugCode As Integer, Unit As Integer
Dim Amount As Double, Price As Double
Dim iRow As Long
DateRec = DTPicker1.Value
LastName = Me.LastName.text
FirstName = Me.FirstName.text
FullName = LastName & " " & FirstName
DrugCode = CInt(DrugCode.Value)
Unit = CInt(Me.UnitsTextBox.Value)
Amount = CDbl(Me.UnitsTextBox.Value)
Price = CDbl(Me.Price.Value)
'Date, Customer name,drug code, amount, price
Set ws = Worksheets("Sales Record")
ws.Select
'the first empty row
iRow = ws.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).Row
ws.Cells(iRow, 1).Value = DateRec
ws.Cells(iRow, 2).Value = FullName
ws.Cells(iRow, 3).Value = DrugCode
ws.Cells(iRow, 4).Value = Amount
ws.Cells(iRow, 5).Value = Price
End Sub
The name of the combo boxes and text boxes are changed to the ones written above.
ie. the drugcode combobox is named drugcode
1. Somehow i keep getting an invalid qualifier for DrugCode = CInt(DrugCode.Value) and Price = CDbl(Me.Price.Value).
2. before I added the Me. in front of the LastName.text I kept getting an invalid qualifier error as well. What does the Me. do?
Bookmarks