Bill Williamson
Board Regular
- Joined
- Oct 7, 2019
- Messages
- 124
[TABLE="width: 1444"]
<colgroup><col span="2"><col><col><col><col span="2"><col><col><col><col><col><col><col><col></colgroup><tbody>
[TR]
[TD][/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] I recently added a search button to my userform, But it does not seem to search. I am trying to use existing Text Boxs for searching by either
Customer Name, CSO# or Job # then returning any matches for possible editing. Once I get the search to work, I can try to figure out the update button. one step at a time right?
I appreciate any help available with this. Not even sure if I am using the correct type of search for the Data.
Thanks in Advance.
Bill Williamson
[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
<colgroup><col span="2"><col><col><col><col span="2"><col><col><col><col><col><col><col><col></colgroup><tbody>
[TR]
[TD][/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] I recently added a search button to my userform, But it does not seem to search. I am trying to use existing Text Boxs for searching by either
Customer Name, CSO# or Job # then returning any matches for possible editing. Once I get the search to work, I can try to figure out the update button. one step at a time right?
I appreciate any help available with this. Not even sure if I am using the correct type of search for the Data.
Code:
Private Sub Clearform()
End Sub
Private Sub ApperanceCheckBox_Click()
End Sub
Private Sub BRReviewCheckBox_Click()
End Sub
Private Sub BRReview_Click()
End Sub
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub CommandButton1_Click()
'Show User form
UserForm1.Show
End Sub
Private Sub ClearButton_Click()
'Sub Clearform()
Dim ctrl As MSForms.Control
For Each ctrl In Me.Controls
Select Case TypeName(ctrl)
Case "TextBox"
ctrl.Text = ""
Case "ComboBox"
ctrl.ListIndex = -1
Case "CheckBox"
ctrl.Value = False
End Select
Next
End Sub
Private Sub UserForm1_Click()
End Sub
Private Sub UserForm1_Initialize()
End Sub
Private Sub CMDSearch_Click()
Dim totRows As Long, i As Long
totRows = Worksheets("Sheet1").Range("Ai").CurrentRegion.Rows.Count
If Customer.Text = "" Then
MsgBox "Enter Search Criteria"
End If
For i = 2 To totRows
If Trim(Sheet1.Cells(i, 1)) = Trim(TextBox1.Text) Then
Customer.Text = Sheet1.Cells(i, 1)
CSONumber.Text = Sheet1.Cells(i, 2)
JobNumber.Text = Sheet1.Cells(i, 3)
Exit For
End If
Next i
End Sub
Private Sub CMDUpdate_Click()
Dim EmptyRow As Long
'Make Sheet1 Active
Sheet1.Activate
'Update Records
Answer = MsgBox("Are you sure you want to update?", vbYesNo + vbQuestion, "Update Record")
If Answer = vbYes Then
Cells(CurrentRow, 1).Value = Customer.Value
Cells(CurrentRow, 2).Value = CSONumber.Value
Cells(CurrentRow, 3).Value = JobNumber.Value
Cells(CurrentRow, 4).Value = PCWeldType.Value
Cells(CurrentRow, 5).Value = PCWeldGrind.Value
Cells(CurrentRow, 6).Value = PCFinish.Value
Cells(CurrentRow, 7).Value = NonPCWeld.Value
Cells(CurrentRow, 8).Value = NonPCGrind.Value
Cells(CurrentRow, 9).Value = NonPCFinish.Value
If BRReview.Value = True Then Cells(CurrentRow, 10).Value = "Yes"
If BRReview.Value = False Then Cells(CurrentRow, 10).Value = "No"
If BOMReview.Value = True Then Cells(CurrentRow, 11).Value = "Yes"
If BOMReview.Value = False Then Cells(CurrentRow, 11).Value = "No"
If DimReview.Value = True Then Cells(CurrentRow, 12).Value = "Yes"
If DimReview.Value = False Then Cells(CurrentRow, 12).Value = "No"
If WeldReview.Value = True Then Cells(CurrentRow, 13).Value = "Yes"
If WeldReview.Value = False Then Cells(CurrentRow, 13).Value = "No"
If Apperance.Value = True Then Cells(CurrentRow, 14).Value = "Yes"
If Apperance.Value = False Then Cells(CurrentRow, 14).Value = "No"
If Complete.Value = True Then Cells(CurrentRow, 15).Value = "Yes"
If Complete.Value = False Then Cells(CurrentRow, 15).Value = "No"
End If
End Sub
Private Sub OKButton_Click()
Dim EmptyRow As Long
'Make Sheet1 Active
Sheet1.Activate
'Determine Empty Row
EmptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
'Transfer Information
Cells(EmptyRow, 1).Value = Customer.Value
Cells(EmptyRow, 2).Value = CSONumber.Value
Cells(EmptyRow, 3).Value = JobNumber.Value
Cells(EmptyRow, 4).Value = PCWeldType.Value
Cells(EmptyRow, 5).Value = PCWeldGrind.Value
Cells(EmptyRow, 6).Value = PCFinish.Value
Cells(EmptyRow, 7).Value = NonPCWeld.Value
Cells(EmptyRow, 8).Value = NonPCGrind.Value
Cells(EmptyRow, 9).Value = NonPCFinish.Value
If BRReview.Value = True Then Cells(EmptyRow, 10).Value = "Yes"
If BRReview.Value = False Then Cells(EmptyRow, 10).Value = "No"
If BOMReview.Value = True Then Cells(EmptyRow, 11).Value = "Yes"
If BOMReview.Value = False Then Cells(EmptyRow, 11).Value = "No"
If DimReview.Value = True Then Cells(EmptyRow, 12).Value = "Yes"
If DimReview.Value = False Then Cells(EmptyRow, 12).Value = "No"
If WeldReview.Value = True Then Cells(EmptyRow, 13).Value = "Yes"
If WeldReview.Value = False Then Cells(EmptyRow, 13).Value = "No"
If Apperance.Value = True Then Cells(EmptyRow, 14).Value = "Yes"
If Apperance.Value = False Then Cells(EmptyRow, 14).Value = "No"
If Complete.Value = True Then Cells(EmptyRow, 15).Value = "Yes"
If Complete.Value = False Then Cells(EmptyRow, 15).Value = "No"
'Sub Clearform()
Dim ctrl As MSForms.Control
For Each ctrl In Me.Controls
Select Case TypeName(ctrl)
Case "TextBox"
ctrl.Text = ""
Case "ComboBox"
ctrl.ListIndex = -1
Case "CheckBox"
ctrl.Value = False
End Select
Next
End Sub
Private Sub UserForm_Click()
Call UserForm1_Initialize
End Sub
Thanks in Advance.
Bill Williamson
[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]