Bypass entry of data from Lookup Table

  • Thread starter Thread starter Jim May
  • Start date Start date
J

Jim May

On an Entry form (Userform) I'm trying to allow for the Entry of
new items MANUALLY that are not in a pre-defined lookup table.
My line 3 and 4 below is a poor attempt at doing so <<IS NOT WORKING>>; Can
someone
suggest the code to allow me to enter all 7 fields manually?
TIA,


Private Sub cbVenCode_AfterUpdate()
Set MyVenTable = Range("VenTable")
If Application.VLookup(Me.cbVencode, MyVenTable, 2, False) = "" Then
Exit Sub
End If
txtVenName.Value = Application.VLookup(Me.cbVencode, MyVenTable, 2,
False)
txtVAdd1.Value = Application.VLookup(Me.cbVencode, MyVenTable, 3, False)
txtVAdd2.Value = Application.VLookup(Me.cbVencode, MyVenTable, 4, False)
txtCity.Value = Application.VLookup(Me.cbVencode, MyVenTable, 5, False)
txtSt.Value = Application.VLookup(Me.cbVencode, MyVenTable, 6, False)
txtZip.Value = Application.VLookup(Me.cbVencode, MyVenTable, 7, False)
Set MyVenTable = Nothing
End Sub
 
if iserror(application.match(me.cbvencode,myventable.columns(1),0)) then
'allow manual entry
'make the textboxes enabled?
else
'just show the values
'and disable the textboxes so no changes can be made?
end if

Maybe....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top