G
Guest
Changing a code Variable from a form
I want to be able to change a code variable that I have set in a module from
a form. Is this possible? I am building it an adp but it should be the same
as with any other access database. I just don’t know how to change a module
from a form or even if it’s possible.
Below is the code that I have.
Is it possible for me to make a form control that I can use to change
“constant_Unit†in access 2002?
Thanks
-----------------
Option Compare Database
Global Unit As String, UnitName As String
Global ReportCaption As String
Public Sub DeclairConstants()
Dim cnnt1 As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strDBName As String
Dim intCount As Integer
Dim strTable As String
Dim fld As ADODB.Field
Dim constant_Unit As String
constant_Unit = "WAY8AA" '*** THIS IS THE VARIABLE, CONSTANT I WANT
TO CHANGE.
strTable = "tbl_Constants"
Set cnnt1 = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.CursorType = adOpenForwardOnly
rst.LockType = adLockReadOnly
rst.Open "tbl_Constants", cnnt1
rst.MoveFirst
rst.Find ("UIC = '" & constant_Unit & "'") '********* finds the record
that I want to work with ********
UnitName = rst!Name
UIC = rst!UIC
rst.Close
Set rst = Nothing
End Sub
I want to be able to change a code variable that I have set in a module from
a form. Is this possible? I am building it an adp but it should be the same
as with any other access database. I just don’t know how to change a module
from a form or even if it’s possible.
Below is the code that I have.
Is it possible for me to make a form control that I can use to change
“constant_Unit†in access 2002?
Thanks
-----------------
Option Compare Database
Global Unit As String, UnitName As String
Global ReportCaption As String
Public Sub DeclairConstants()
Dim cnnt1 As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strDBName As String
Dim intCount As Integer
Dim strTable As String
Dim fld As ADODB.Field
Dim constant_Unit As String
constant_Unit = "WAY8AA" '*** THIS IS THE VARIABLE, CONSTANT I WANT
TO CHANGE.
strTable = "tbl_Constants"
Set cnnt1 = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.CursorType = adOpenForwardOnly
rst.LockType = adLockReadOnly
rst.Open "tbl_Constants", cnnt1
rst.MoveFirst
rst.Find ("UIC = '" & constant_Unit & "'") '********* finds the record
that I want to work with ********
UnitName = rst!Name
UIC = rst!UIC
rst.Close
Set rst = Nothing
End Sub