I need some help. I need to add a combo box to a form. When I make a selection in the combo box and add the Info to my form it goes to the truck I select. But if I don’t enter Data in then text box it will delete my data off my sheet. And one more thing I need to enter it on a different sheet. So when I select the truck in the combo box and enter the data in. It will go to PM_SUMMARY and to the truck log. There are like 50 of them. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o> </o>
sheet are 7-9301<o></o>
7-0302 <o></o>
PM_SUMMARY
Private Sub cmdAdd_Click()
Dim ws As Worksheet
Set ws = Worksheets("PM_SUMMARY")
'check for a date
If Trim(Me.txtDate.Value) = "" Then
Me.txtDate.SetFocus
MsgBox "Please enter a Date "
Exit Sub
End If
'check for a hours
If Trim(Me.txtHR.Value) = "" Then
Me.txtHR.SetFocus
MsgBox "Please enter a Mileage/Hours"
Exit Sub
End If
'copy the data to the database
ws.Cells(6, 10).Value = Me.txtDate.Value
ws.Cells(6, 6).Value = Me.txtDot.Value
ws.Cells(6, 14).Value = Me.txtDatePm.Value
ws.Cells(6, 12).Value = Me.txtHR.Value
ws.Cells(6, 16).Value = Me.txtPm.Value
End
Unload Me
End Sub
Private Sub txtDate_Change()
Me.txtDate.Value = Date
End Sub
Ok a lot of it lol
<o> </o>
sheet are 7-9301<o></o>
7-0302 <o></o>
PM_SUMMARY
Private Sub cmdAdd_Click()
Dim ws As Worksheet
Set ws = Worksheets("PM_SUMMARY")
'check for a date
If Trim(Me.txtDate.Value) = "" Then
Me.txtDate.SetFocus
MsgBox "Please enter a Date "
Exit Sub
End If
'check for a hours
If Trim(Me.txtHR.Value) = "" Then
Me.txtHR.SetFocus
MsgBox "Please enter a Mileage/Hours"
Exit Sub
End If
'copy the data to the database
ws.Cells(6, 10).Value = Me.txtDate.Value
ws.Cells(6, 6).Value = Me.txtDot.Value
ws.Cells(6, 14).Value = Me.txtDatePm.Value
ws.Cells(6, 12).Value = Me.txtHR.Value
ws.Cells(6, 16).Value = Me.txtPm.Value
End
Unload Me
End Sub
Private Sub txtDate_Change()
Me.txtDate.Value = Date
End Sub
Ok a lot of it lol