Hi All,
I have a swith board with many command buttons to open the other forms to enter data.
And I want the add this function to the switch board. When I enter the RepairID, and click on certain button, it will automatically find the relevant form and open. The code is like this:
Code:
Private Sub cmdInitialCheck_Click()
Dim strPartNumber As String
Dim strATA As String
Dim strFormName As String
strPartNumber = DLookup("PartNumber", "tblRepairID", "[RepairID]='" & Me.RepairID.Value & "'")
strATA = DLookup("ATA", "tblATA", "[PartNumber]='" & strPartNumber & "'")
strFormName = "frm" & strATA & "InitialCheck"
DoCmd.OpenForm strFormName
End Sub
Here is my question, how can I make the strPartNumber and strATA can be used on all the button of the form? So that I dont need to type it again and again in the code of other command buttons. I think I'm just lazy...
I searched and found maybe the private variable is what I need, but I failed to get it work.
Thanks in advanced...