I am working on a data entry form that puts the entries into a spreadsheet. For my date box I would like the user to only be able to enter in the dates from 03/01/2003 through 08/01/2006 by using the mm/dd/yyyy format. Below is the source code I have so far. Any help or suggestions would be greatly appreciated! Thanks!
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Excise Tax Data")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
'check for a blank text box
If Trim(Me.txtName.Value) = "" Then
MsgBox "Please enter a vendor name"
If Trim(Me.txtDate.Value) = "" Then
MsgBox "Please enter a Date"
If Trim(Me.txtAccount.Value) = "" Then
MsgBox "Please enter an Account Number"
If Trim(Me.txtAmount.Value) = "" Then
MsgBox "Please enter an Excise Tax Amount"
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtName.Value
ws.Cells(iRow, 2).Value = Me.txtDate.Value
ws.Cells(iRow, 3).Value = Me.txtAccount.Value
ws.Cells(iRow, 4).Value = Me.txtAmount.Value
'clear the data
Me.txtName.Value = ""
Me.txtDate.Value = ""
Me.txtAccount.Value = ""
Me.txtAmount.Value = ""
'contains running sum on form
Me.txtTotalAmt.Value = ws.Cells(1, 7).Value
0 · ·