Textbox to return lookup info

pace

New Member
Joined
Feb 25, 2002
Messages
28
I have a userform set up for data entry, I would like a number of textboxes to autofill from a database depending on if the surname matches to an existing client.

For example, if Smith was entered in the Name field, his address, phone no, email, etc would automatically appear in the relevant textboxes from the client database. If no match all fields would remain empty (the inputted info doesn't go into the database unless you click on a checkbox).

I've tried VLOOKUP's, variables, etc, any help please.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You can use VLOOKUP, but, since you're doing that from VBA, you should call it like

MyAnswer = Application.Vlookup(Value,Range,column,matchtype)

what have you tried ? (VLOOKUP's, variables, etc.) ?
 
Upvote 0
Juan,

Thanks for the help, still didn't quite work. Here's the code I have so far if it helps.Dim sTitle As String
Dim sName As String


Private Sub ComboBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

sName = Range("Name").Value
sTitle = Application.VLookup(sName, Regular_Database, 2, False)


If (Range("Lookup_Check").Value = "FALSE") Then
EnterGuest.ComboBox3.Text = sTitle
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,521
Messages
6,172,812
Members
452,481
Latest member
Najwan

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