Fanciesmom
New Member
- Joined
- Feb 15, 2013
- Messages
- 3
I am beginning to wonder if I am asking the impossible here but here goes.
I am new to this and to top it off I have a bit of a time constraint so bungling along until I accidentally figure this out is not going to work.
I am designing a reservation system for an RV park. I have a userform designed to gather data and post it to a worksheet. The workbook contains a worksheet for reservations, availability, long term, and group reservations. It also has monthly sheets where I eventually will sort the data from reservations and fill out the monthly sheets - but that is down the road.
Right now my immediate problem is to come up with code that will use the numeric value of TBToday (using the year?) and 4 additional numbers to display a unique "ResrvNum" in the TBResrvNum textbox. This number has to display when the form opens so that the number can be written on the paper record and used to fill out a manual chart (until I get the rest of this done).
I was going to use a concatenation formula in column AE on the Reservations worksheet - but the number has to be the first thing on the userform rather than happening after the info is written to the worksheet.
I am new to this and to top it off I have a bit of a time constraint so bungling along until I accidentally figure this out is not going to work.
I am designing a reservation system for an RV park. I have a userform designed to gather data and post it to a worksheet. The workbook contains a worksheet for reservations, availability, long term, and group reservations. It also has monthly sheets where I eventually will sort the data from reservations and fill out the monthly sheets - but that is down the road.
Right now my immediate problem is to come up with code that will use the numeric value of TBToday (using the year?) and 4 additional numbers to display a unique "ResrvNum" in the TBResrvNum textbox. This number has to display when the form opens so that the number can be written on the paper record and used to fill out a manual chart (until I get the rest of this done).
I was going to use a concatenation formula in column AE on the Reservations worksheet - but the number has to be the first thing on the userform rather than happening after the info is written to the worksheet.
Code:
Private Sub Workbook_Open()
Worksheets("trying new things test").Activate
FrmReservations.Show
End Sub
Private Sub ComOK_Click()
Dim Rowcount As Long
Dim Ctl As Control
Dim ws As Worksheet
' Check user input
If TBToday.Value = "" Then
MsgBox "Please Enter Today's Date!"
TBToday.SetFocus
Exit Sub
End If
If CBEmp.Value = "" Then
MsgBox "Please Select Employee ID"
CBEmp.SetFocus
Exit Sub
End If
If CBSite.Value = "" Then
MsgBox "Please Select an Available Site"
CBSite.SetFocus
Exit Sub
End If
If TBLastName.Value = "" Then
MsgBox "Please Enter a Last Name"
TBLastName.SetFocus
Exit Sub
End If
If TBFirstName.Value = "" Then
MsgBox "Please Enter a First Name"
TBFirstName.SetFocus
Exit Sub
End If
If TBAddress.Value = "" Then
MsgBox "Please Enter an Address"
TBAddress.SetFocus
Exit Sub
End If
If TBCity.Value = "" Then
MsgBox "Please Enter a City"
TBCity.SetFocus
Exit Sub
End If
If TBState.Value = "" Then
MsgBox "Please Enter a State"
TBState.SetFocus
Exit Sub
End If
If TBZipcode.Value = "" Then
MsgBox "Please Enter a Zip Code"
TBZipcode.SetFocus
Exit Sub
End If
If TBPhone.Value = "" Then
MsgBox "Please Enter a Phone Number"
TBPhone.SetFocus
Exit Sub
End If
If TBCell.Value = "" Then
MsgBox "Please Enter a Cell Phone Number"
TBCell.SetFocus
Exit Sub
End If
If TBEmail.Value = "" Then
MsgBox "Please Enter an Email Address"
TBEmail.SetFocus
Exit Sub
End If
If TBArrival.Value = "" Then
MsgBox "Please Enter an Arrival Date"
TBArrival.SetFocus
Exit Sub
End If
If TBDepart.Value = "" Then
MsgBox "Please Enter a Departure Date"
TBDepart.SetFocus
Exit Sub
End If
If TBDays.Value = "" Then
MsgBox "Please Enter How Many Days"
TBDays.SetFocus
Exit Sub
End If
If CBKind.Value = "" Then
MsgBox "Please Choose the Kind"
CBKind.SetFocus
Exit Sub
End If
If CBAdults.Value = "" Then
MsgBox "Please Enter Number of Adults"
CBAdults.SetFocus
Exit Sub
End If
If CBKids.Value = "" Then
MsgBox "Please Enter Number of Children"
CBKids.SetFocus
Exit Sub
End If
If CBVehicles.Value = "" Then
MsgBox "Please Enter Number of Vehicles"
CBVehicles.SetFocus
Exit Sub
End If
If CBPower.Value = "" Then
MsgBox "Please Select Power Needed"
CBPower.SetFocus
Exit Sub
End If
If CBPets.Value = "" Then
MsgBox "Please Check if There Are Pets"
CBPets.SetFocus
End If
' Write data to worksheet
Rowcount = Worksheets("Reservations").Range("A" & Rows.Count).End(xlUp).Row + 1
With Worksheets("Reservations")
.Cells(Rowcount, "A").Value = TBToday.Value
.Cells(Rowcount, "B").Value = CBEmp.Value
.Cells(Rowcount, "C").Value = CBSite.Value
.Cells(Rowcount, "D").Value = TBLastName.Value
.Cells(Rowcount, "E").Value = TBFirstName.Value
.Cells(Rowcount, "F").Value = TBAddress.Value
.Cells(Rowcount, "G").Value = TBCity.Value
.Cells(Rowcount, "H").Value = TBState.Value
.Cells(Rowcount, "I").Value = TBZipcode.Value
.Cells(Rowcount, "J").Value = TBPhone.Value
.Cells(Rowcount, "K").Value = TBCell.Value
.Cells(Rowcount, "L").Value = TBEmail.Value
.Cells(Rowcount, "M").Value = TBArrival.Value
.Cells(Rowcount, "N").Value = TBDepart.Value
.Cells(Rowcount, "O").Value = TBDays.Value
.Cells(Rowcount, "P").Value = CBKind.Value
.Cells(Rowcount, "Q").Value = CBAdults.Value
.Cells(Rowcount, "R").Value = CBKids.Value
.Cells(Rowcount, "S").Value = CBVehicles.Value
.Cells(Rowcount, "T").Value = CBPower.Value
.Cells(Rowcount, "U").Value = CBPets.Value
.Cells(Rowcount, "V").Value = CBLongTerm.Value
.Cells(Rowcount, "W").Value = CBGroup.Value
.Cells(Rowcount, "X").Value = CBRecBldg.Value
.Cells(Rowcount, "Y").Value = CBSites.Value
.Cells(Rowcount, "Z").Value = CBPkg.Value
.Cells(Rowcount, "AA").Value = TBNotes.Value
End With
'Clear the form for the next entry
Me.TBToday.Value = ""
Me.CBEmp.Value = ""
Me.CBSite.Value = ""
Me.TBLastName.Value = ""
Me.TBFirstName.Value = ""
Me.TBAddress.Value = ""
Me.TBCity.Value = ""
Me.TBState.Value = ""
Me.TBZipcode.Value = ""
Me.TBPhone.Value = ""
Me.TBCell.Value = ""
Me.TBEmail.Value = ""
Me.TBArrival.Value = ""
Me.TBDepart.Value = ""
Me.TBDays.Value = ""
Me.CBKind.Value = ""
Me.CBAdults.Value = ""
Me.CBKids.Value = ""
Me.CBVehicles.Value = ""
Me.CBPower.Value = ""
Me.CBPets.Value = ""
Me.CBLongTerm.Value = ""
Me.CBGroup.Value = ""
Me.CBRecBldg.Value = ""
Me.CBSites.Value = ""
Me.CBPkg.Value = ""
Me.TBNotes.Value = ""
Me.TBToday.SetFocus
End Sub
Private Sub ComCancel_Click()
Unload Me
End Sub