Forms changing public const

  • Thread starter Thread starter Biggles
  • Start date Start date
B

Biggles

Hello all, I have a little question

I have some public constructs in a module, that I want to manipulate via a
form, mainly to keep users out of my VBA. When I open the form, I have:

Private Sub Form_Open(Cancel As Integer)

v_begdate = basISSUE_TRACK_BKUP!Begdate
v_begyear = basISSUE_TRACK_BKUP!begyear
v_enddate = basISSUE_TRACK_BKUP!enddate
v_audcom = basISSUE_TRACK_BKUP!audcomm

End Sub

And when I edit the data in the form, in my after update for each of the
fields above:

Private Sub v_audcom_AfterUpdate()

basISSUE_TRACK_BKUP!audcomm = v_audcom

End Sub

Private Sub v_begdate_AfterUpdate()

basISSUE_TRACK_BKUP!Begdate = v_begdate

End Sub

Private Sub v_begyear_AfterUpdate()

basISSUE_TRACK_BKUP!begyear = v_begyear

End Sub

Private Sub v_enddate_AfterUpdate()

basISSUE_TRACK_BKUP!enddate = v_enddate

End Sub

And my public constructs in the basISSUE_TRACK_BKUP module:

Public Const Begdate = #1/4/2008#
Public Const begyear = #1/4/2008#
Public Const enddate = #1/31/2008#
Public Const audcomm = 0 (boolean)

Can this be done?
 
You can't change a constant. That is why it is called a constant. It has a
constant value throughout its life. You can assign the values as shown in
the load event of the form, but you cannot assign a different value to them.
If you need to do this, don't use constants, you will need to use a table, or
other method (such as an INI file) to store the values and load them at run
time but also be able to modify and store their revised data.
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
If my post was helpful to you, please rate the post.
__________________________________
 
Back
Top