briansmithdanisco
IS-IT--Management
Hi,
Is it possible to have a variable in a reference to a form name?
I have a sub-form that I want to use in several main fomrs. It calculates plant processing times. Based on a menu selectin, the different forms will be displayed with the common sub-form. The update process for the tables associated with each of the main forms will use some header data that is entered and, the data entered from the sub-form.
What I would like to do is:
Dim strFormName as String
' Set the variable based on what form button is pressed.
strFormName = gstrGlobalFormVariable
' Reference the
With rst
.Fields("TotalTimeDetail") = dteTimeCalc
.Fields("PlantLocation") = [Forms]![strFormName].Form![Plant]
.Update
End With
This will update some data on the table with the calculated data and what plant entered the data. I have tried putting quotes, and & around the "strFormName" but I always get an error that the form name can't be found.
Any ideas?
Thanks.
Is it possible to have a variable in a reference to a form name?
I have a sub-form that I want to use in several main fomrs. It calculates plant processing times. Based on a menu selectin, the different forms will be displayed with the common sub-form. The update process for the tables associated with each of the main forms will use some header data that is entered and, the data entered from the sub-form.
What I would like to do is:
Dim strFormName as String
' Set the variable based on what form button is pressed.
strFormName = gstrGlobalFormVariable
' Reference the
With rst
.Fields("TotalTimeDetail") = dteTimeCalc
.Fields("PlantLocation") = [Forms]![strFormName].Form![Plant]
.Update
End With
This will update some data on the table with the calculated data and what plant entered the data. I have tried putting quotes, and & around the "strFormName" but I always get an error that the form name can't be found.
Any ideas?
Thanks.