Technically you don't "Get" or "Send" values to/from a Module.
You typically can retrieve a Public Variable using a Public Function.
...And store values in public variables.
Something like this in a Public Module:
Public lngpubCustomerID as long
Public Function GetCustomerID () as long
GetCustomerID =lngpubCustomerID
End function
Now you can set the public variable from anywhere in your project, something like this:
lngpubCustomerID =me.cboCustomerID
...Then retrieve it with this:
SomeThing=GetCustomerID()
Note that you may also have to implement a system to "reset" the variable.
The danger here is that you must tightly control where, when and how you set the Variable, or things could get confusing.
JeffCoachman
bill201
ASKER
Thanks for Your Answer sorry for the delay i was outside the town...
iry the code that you give but its not working
this is my code in the form that i store the variable
Public Sub Command21_Click()
Dim strFormName As String
strFormName = Me.Name
GetFormNameSt = strFormName
End Sub
and this is my public module
Option Compare Database
Public GetFormNameSt As String
Public Function GetFormName() As String
GetFormName = GetFormNameSt
End Function
and in the other form where i want to retrive the variable i wrote this code in a command buttan
Private Sub Command0_Click()
Dim b
b = GetFormNameSt
MsgBox b
End Sub
but the problem that i get a blank msgbox without the form name
thanks thousand times for your excellent and detailed answer i'm grateful for you, I'm more than supplied from your professional answer and it is a pity that i don't can to give your more then 500 points...
You typically can retrieve a Public Variable using a Public Function.
...And store values in public variables.
Something like this in a Public Module:
Public lngpubCustomerID as long
Public Function GetCustomerID () as long
GetCustomerID =lngpubCustomerID
End function
Now you can set the public variable from anywhere in your project, something like this:
lngpubCustomerID =me.cboCustomerID
...Then retrieve it with this:
SomeThing=GetCustomerID()
Note that you may also have to implement a system to "reset" the variable.
The danger here is that you must tightly control where, when and how you set the Variable, or things could get confusing.
JeffCoachman