calumbus53
New Member
- Joined
- Feb 22, 2018
- Messages
- 17
Hi guys,
I searched the forum and found some code which I was able to use in my form to create a lookup to populate other TextBox within my Form.
The code works fine when matching and looking up the values for the other cells, but I am not able to delete the value/enter my own random property in the ComboBox for use when "adding" to the database at a later date.
I have been using the code below:
Private Sub cmbTestDesc_Change()
Dim matchTest As Variant
matchTest = cmbTestDesc.Value = Application.WorksheetFunction.Index(Sheets("Sheet_Working").Range("B3:B13"), _
Application.WorksheetFunction.Match(cmbTestDesc.Value, Sheets("Sheet_Working").Range("B3:B10000"), 0), 1)
If matchTest = True Then
txtTestProc.Value = Application.WorksheetFunction.Index(Sheets("Sheet_Working").Range("C3:C10000"), _
Application.WorksheetFunction.Match(cmbTestDesc.Value, Sheets("Sheet_Working").Range("B3:B10000"), 0), 1)
txtUTID.Value = Application.WorksheetFunction.Index(Sheets("Sheet_Working").Range("A3:A13"), _
Application.WorksheetFunction.Match(cmbTestDesc.Value, Sheets("Sheet_Working").Range("B3:B10000"), 0), 1)
End If
End Sub
I have tried it a number of different ways but when I try typing in the ComboBox or deleting the value that is in there, I get the error: "Run-time Error '1004: Unable to get the Match property of the WorksheetFunction class."
The bit I will need to try do after solving this is add the value "IF DOES NOT EXIST" to the bottom of the list in the data base.
Any help would be great, cheers.
Cal
I searched the forum and found some code which I was able to use in my form to create a lookup to populate other TextBox within my Form.
The code works fine when matching and looking up the values for the other cells, but I am not able to delete the value/enter my own random property in the ComboBox for use when "adding" to the database at a later date.
I have been using the code below:
Private Sub cmbTestDesc_Change()
Dim matchTest As Variant
matchTest = cmbTestDesc.Value = Application.WorksheetFunction.Index(Sheets("Sheet_Working").Range("B3:B13"), _
Application.WorksheetFunction.Match(cmbTestDesc.Value, Sheets("Sheet_Working").Range("B3:B10000"), 0), 1)
If matchTest = True Then
txtTestProc.Value = Application.WorksheetFunction.Index(Sheets("Sheet_Working").Range("C3:C10000"), _
Application.WorksheetFunction.Match(cmbTestDesc.Value, Sheets("Sheet_Working").Range("B3:B10000"), 0), 1)
txtUTID.Value = Application.WorksheetFunction.Index(Sheets("Sheet_Working").Range("A3:A13"), _
Application.WorksheetFunction.Match(cmbTestDesc.Value, Sheets("Sheet_Working").Range("B3:B10000"), 0), 1)
End If
End Sub
I have tried it a number of different ways but when I try typing in the ComboBox or deleting the value that is in there, I get the error: "Run-time Error '1004: Unable to get the Match property of the WorksheetFunction class."
The bit I will need to try do after solving this is add the value "IF DOES NOT EXIST" to the bottom of the list in the data base.
Any help would be great, cheers.
Cal