I created a module that will not work.
Public Sub LookupValue()
Dim X, Y As String
On Error GoTo ERR_txtRefDesig
Dim FormName As String
Dim TableName As String
Dim FormEntryTextBox As String
Dim DisplayTextBox1 As String
Dim EntryTextBoxFromTable1 As String
Dim LookupValueFromTable1 As String
TableName = TblPartsList
FormName = frmInitialInspectionDefect
EntryTextBoxFromTable1 = "RefDesignation"
FormEntryTextBox = "txtRefDesig"
DisplayTextBox1 = "txtPartDescription"
LookupValueFromTable1 = "PartDescription"
Forms![FormName]![DisplayTextBox1] = DLookup("[LookupValueFromTable1]", "TableName", "[EntryTextBoxFromTable1] Like '*" & Forms![FormName]!FormEntryTextBox & "*'")
Forms![frmInitialInspectionDefect]![txtPartDescription] = DLookup("[PartDescription]", "TblPartsList", "[RefDesignation] Like '*" & Forms![frmInitialInspectionDefect]!txtRefDesig & "*'")
Exit Sub
ERR_txtRefDesig:
MsgBox "Information not available. Contact Administrator x412"
Exit Sub
End Sub
When I step through the procedure it tells me Access can't find my form. Any sugesstions?
Public Sub LookupValue()
Dim X, Y As String
On Error GoTo ERR_txtRefDesig
Dim FormName As String
Dim TableName As String
Dim FormEntryTextBox As String
Dim DisplayTextBox1 As String
Dim EntryTextBoxFromTable1 As String
Dim LookupValueFromTable1 As String
TableName = TblPartsList
FormName = frmInitialInspectionDefect
EntryTextBoxFromTable1 = "RefDesignation"
FormEntryTextBox = "txtRefDesig"
DisplayTextBox1 = "txtPartDescription"
LookupValueFromTable1 = "PartDescription"
Forms![FormName]![DisplayTextBox1] = DLookup("[LookupValueFromTable1]", "TableName", "[EntryTextBoxFromTable1] Like '*" & Forms![FormName]!FormEntryTextBox & "*'")
Forms![frmInitialInspectionDefect]![txtPartDescription] = DLookup("[PartDescription]", "TblPartsList", "[RefDesignation] Like '*" & Forms![frmInitialInspectionDefect]!txtRefDesig & "*'")
Exit Sub
ERR_txtRefDesig:
MsgBox "Information not available. Contact Administrator x412"
Exit Sub
End Sub
When I step through the procedure it tells me Access can't find my form. Any sugesstions?