Pulling out data from file to userform? Using search button on userform

relor

New Member
Joined
Mar 19, 2013
Messages
25
I ALREADY GOT A USERFORM TO BE FILLED UP BY USERS WRITTEN DIRECTLY TO ANOTHER SHEET.. BUT HOW DO I CREATE A SEARCH QUERY THAT WILL PULL OUT DATA AND SHOW THE CLIENT THAT HE HAS ALREADY FILLED UP THE FORM?

IS IT POSSIBLE OR NOT?

========================================================================================
Private Sub AGENT_Change()
End Sub


Private Sub CLIENT_Change()


End Sub


Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("INPUTS")


'''find first empty row in database
''iRow = ws.Cells(Rows.Count, 1) _
'' .End(xlUp).Offset(1, 0).Row
'revised code to avoid problems with Excel tables in newer versions
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1


'check for a part number
If Trim(Me.STARTDATE.Value) = "" Then
Me.STARTDATE.SetFocus
MsgBox "Please enter a part number"
Exit Sub
End If


'copy the data to the database
ws.Cells(iRow, 1).Value = Me.STARTDATE.Value
ws.Cells(iRow, 2).Value = Me.ENDDATE.Value
ws.Cells(iRow, 3).Value = Me.CLIENT.Value
ws.Cells(iRow, 4).Value = Me.AGENT.Value
ws.Cells(iRow, 5).Value = Me.ComboBox1.Value
ws.Cells(iRow, 6).Value = Me.COUNT.Value
ws.Cells(iRow, 7).Value = Me.SENIOR.Value
ws.Cells(iRow, 8).Value = Me.D_I.Value
ws.Cells(iRow, 9).Value = Me.MONTHLY.Value
ws.Cells(iRow, 10).Value = Me.CONTACT.Value
ws.Cells(iRow, 11).Value = Me.STREET.Value
ws.Cells(iRow, 12).Value = Me.POSTAL.Value
ws.Cells(iRow, 13).Value = Me.FEEDBACK.Value
ws.Cells(iRow, 14).Value = Me.REMARKS.Value


'clear the data
Me.STARTDATE.Value = ""
Me.ENDDATE.Value = ""
Me.CLIENT.Value = ""
Me.AGENT.Value = ""
Me.ComboBox1.Value = ""
Me.COUNT.Value = ""
Me.SENIOR.Value = ""
Me.D_I.Value = ""
Me.MONTHLY.Value = ""
Me.CONTACT.Value = ""
Me.STREET.Value = ""
Me.POSTAL.Value = ""
Me.FEEDBACK.Value = ""
Me.REMARKS.Value = ""
Me.STARTDATE.SetFocus
End Sub


Private Sub cmdClose_Click()
Unload Me


End Sub






Private Sub ComboBox1_Change()
MsgBox ComboBox1.Value
End Sub
Private Sub UserForm_Initialize()


With ComboBox1
.Clear
.AddItem "PERMANENT"
.AddItem "TRAINEE AGENT"
.AddItem "PROBATIONARY"
.ListIndex = -1
End With
End Sub


Private Sub CONTACT_Change()


End Sub


Private Sub COUNT_Change()


End Sub


Private Sub D_I_Change()


End Sub


Private Sub ENDDATE_Change()


End Sub


Private Sub FEEDBACK_Change()


End Sub


Private Sub MONTHLY_Change()


End Sub


Private Sub POSTAL_Change()


End Sub


Private Sub REMARKS_Change()


End Sub


Private Sub SENIOR_Change()


End Sub


Private Sub STARTDATE_Change()


End Sub






Private Sub STREET_Change()


End Sub


Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the button!"
End If
End Sub
========================================================================================

THIS IS MY SCRIPT FOR SENDING THE FILLED UP USERFORM TO A SINGLE SHEET.. BUT HOW WILL I SEND THE DATA FROM THE SHEET TO THE USERFORM?..
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,196,487
Messages
6,015,489
Members
441,898
Latest member
kofafa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top