I have some code from a cmd button on a form that would normally populate a textbox field with a value from a DLookup value. However, I can't get it to work when I place the form on a tab page which is on another main form.
Private Sub cmdFindOldTable_Click()
Dim strSQL As String
strSQL = "SELECT TableName INTO y_tmpGeneral_ProcessortxtTableOld FROM y_LatestExtracts WHERE ((Mid((Forms![Extract Import Tools].Form![General_Processor]![txtTableNew]), 10, 65))=([y_LatestExtracts].[TrimmedTableName]));"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
Me![txtTableOld] = DLookup("[TableName]", "[y_tmpGeneral_ProcessortxtTableOld]")
DoCmd.SetWarnings True
End Sub
[Extract Import Tools] is the main form. [EIT_Tab] is the subform on that and [General_Processor] is the sub subform on that.
I replaced the Me![txtTableOld] (which used to work when [General_Processor] was a stand alone form) with Forms![Extract Import Tools].Form![General_Processor]![txtTableNew] but I get an error: "Object doesn't support this property or method."
Any ideas anyone??
Private Sub cmdFindOldTable_Click()
Dim strSQL As String
strSQL = "SELECT TableName INTO y_tmpGeneral_ProcessortxtTableOld FROM y_LatestExtracts WHERE ((Mid((Forms![Extract Import Tools].Form![General_Processor]![txtTableNew]), 10, 65))=([y_LatestExtracts].[TrimmedTableName]));"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
Me![txtTableOld] = DLookup("[TableName]", "[y_tmpGeneral_ProcessortxtTableOld]")
DoCmd.SetWarnings True
End Sub
[Extract Import Tools] is the main form. [EIT_Tab] is the subform on that and [General_Processor] is the sub subform on that.
I replaced the Me![txtTableOld] (which used to work when [General_Processor] was a stand alone form) with Forms![Extract Import Tools].Form![General_Processor]![txtTableNew] but I get an error: "Object doesn't support this property or method."
Any ideas anyone??