See the attached, sheet "Dashboard".
you can added records for both databases": enter data then "SUBMIT".
"NEW" clears previous entries.
Added a few eits on Dates and RO/CT number
Private Sub CommandButton1_Click()
For I = 1 To 17
Me.Controls("TextBox" & I) = ""
Next
End Sub
Private Sub CommandButton2_Click()
If Not (IsDate(Me.Controls("TextBox1"))) Or Not (IsDate(Me.Controls("TextBox2"))) Then
MsgBox "Input error in Date fields" & vbCrLf & VdCrLf & "Entry aborted"
Exit Sub
End If
FindString = UCase(Me.Controls("TextBox3"))
If Trim(FindString) <> "" Then
With Sheets("RO-CT Database").Range("C:C")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
MsgBox "Duplicate RO/CT number: " & FindString & vbCrLf & vbCrLf & "Update aborted"
Exit Sub
Else
If Left(FindString, 2) <> "RT" Or Left(FindString, 2) <> "CO" Then
MsgBox "Invalid RO/CT number: " & FindString & vbCrLf & vbCrLf & "Update aborted"
Exit Sub
End If
End If
End With
End If
Call RO_CT_Add_Record
For I = 1 To 17
Cells(2, I) = Me.Controls("TextBox" & I)
If I = 3 Then Cells(2, 3) = UCase(Me.Controls("TextBox" & I))
If I >= 4 Then Cells(2, I) = Val(Cells(2, I))
Next
End Sub
Private Sub CommandButton4_Click()
If Not (IsDate(Me.Controls("TextBox33"))) Or Not (IsDate(Me.Controls("TextBox36"))) _
Or Not (IsDate(Me.Controls("TextBox39"))) Then
MsgBox "Input error in Date fields" & vbCrLf & VdCrLf & "Entry aborted"
Exit Sub
End If
Call Daily_Add_Record
For I = 1 To 3
If I = 3 Then Cells(2, I) = Val(Me.Controls("TextBox" & 32 + I))
Cells(2, I) = Me.Controls("TextBox" & 32 + I)
If I = 3 Then Cells(2, I) = Val(Cells(2, I))
Next
For I = 1 To 3
Cells(2, I + 4) = Me.Controls("TextBox" & 35 + I)
If I = 3 Then Cells(2, I + 4) = Val(Cells(2, I + 4))
Next I
For I = 1 To 6
Cells(2, I + 8) = Me.Controls("TextBox" & 38 + I)
If I >= 2 Then Cells(2, I + 8) = Val(Cells(2, I + 8))
Next
End Sub
Private Sub UserForm_Initialize()
Me.MultiPage1.Value = 0
End Sub
Bookmarks