I have a problem with public variables, I tried exactly what Pat Hardman wrote in Public Variables as Parameters and found that my returnfunction would always be a null value even though my GV did have a value. here is my code:
MODULE:
Option Compare Database
Dim gvactype As String
Public Function Returngvactype() As String
Returngvactype = gvactype
End Function
FORM TO ENTER VALUE:
Option Compare Database
Private Sub searchparts_Click()
gvactype = Me.frmactype
MsgBox gvactype
'i have created the msgbox to makesure the values have entered
DoCmd.openform "FrmPartslistresults"
End Sub
QUERY IN WHICH TO RECALL THE VARIABLE:
WHERE ((([tblA/CParts].[Aircraft Type])=returngvactype())
Id be gratefull if you could help me with this many thanks.
MODULE:
Option Compare Database
Dim gvactype As String
Public Function Returngvactype() As String
Returngvactype = gvactype
End Function
FORM TO ENTER VALUE:
Option Compare Database
Private Sub searchparts_Click()
gvactype = Me.frmactype
MsgBox gvactype
'i have created the msgbox to makesure the values have entered
DoCmd.openform "FrmPartslistresults"
End Sub
QUERY IN WHICH TO RECALL THE VARIABLE:
WHERE ((([tblA/CParts].[Aircraft Type])=returngvactype())
Id be gratefull if you could help me with this many thanks.