I have created a Global Variable and function as below:
In the Query i have written:
SELECT [tblA/CParts].[Part ID], [tblA/CParts].[Part Number], [tblA/CParts].Description, [tblA/CParts].Qty, [tblA/CParts].[JIC Ver], [tblA/CParts].[JIC Number], [tblA/CParts].Discontinued, [tblA/CParts].Notes
FROM [tblA/CParts]
WHERE [tbla/cParts].[Aircraft Type] = Returngvactype()
WHERE [tbla/cParts].[Check Type] = Returngvchecktype()
And to put a value in from a form into the vairable i have written:
I am sure that there is an easier way to do this or that my code is wrong but cant seem to find the answer in past posts can anyone help.
Thanks
Code:
Option Compare Database
Dim gvactype As String
Dim gvchecktype As String
Public Function Returngvactype() As String
Returngvactype = gvactype
End Function
Public Function Returngvactype() As String
Returngvchecktype = gvchecktype
End Function
In the Query i have written:
SELECT [tblA/CParts].[Part ID], [tblA/CParts].[Part Number], [tblA/CParts].Description, [tblA/CParts].Qty, [tblA/CParts].[JIC Ver], [tblA/CParts].[JIC Number], [tblA/CParts].Discontinued, [tblA/CParts].Notes
FROM [tblA/CParts]
WHERE [tbla/cParts].[Aircraft Type] = Returngvactype()
WHERE [tbla/cParts].[Check Type] = Returngvchecktype()
And to put a value in from a form into the vairable i have written:
Code:
Option Compare Database
Private Sub searchparts_Click()
DoCmd.OpenForm "FrmPartslistresults"
gvactype = Me.frmactype
gvchecktype = Me.frmchecktype
MsgBox gvactype ''i have created the msgbox to makesure the values have entered
MsgBox gvchecktype
End Sub
I am sure that there is an easier way to do this or that my code is wrong but cant seem to find the answer in past posts can anyone help.
Thanks
Last edited by a moderator: