QueryFormFields

  • Thread starter Thread starter RickCass
  • Start date Start date
R

RickCass

I would like to store values from a form on close, and
then have those values reappear when the form opens. The
values are dates (Start and End).

Any help?

RickCass
(e-mail address removed)
 
RickCass said:
I would like to store values from a form on close, and
then have those values reappear when the form opens. The
values are dates (Start and End).

There are multiple ways: a public/global variable, as a user-added property
of the database, as a setting in the Registry, or in a table.

How long do you want to preserve them? A global variable will survive at
most, the current session of use. The other approaches can preserve the
values until you have some "software disaster" or other "catastrophe".

Do you want them limited to the user who entered them? If multiple users use
this copy of the front-end or monolithic database, but you want the saved
items to be user-specific you'll need to identify a record in a table with
the userid, or use the Registry. Global variables wouldn't be useful because
each user would start a new session. Database properties would be a bit more
difficult to identify by user.

Start with Help: Public variables, CreateProperty, GetSettings,
SaveSettings. I'd guess you are already familiar with tables, fields, and
accessing them.

Larry Linson
Microsoft Access MVP
 
-----Original Message-----



There are multiple ways: a public/global variable, as a user-added property
of the database, as a setting in the Registry, or in a table.

How long do you want to preserve them? A global variable will survive at
most, the current session of use. The other approaches can preserve the
values until you have some "software disaster" or other "catastrophe".

Do you want them limited to the user who entered them? If multiple users use
this copy of the front-end or monolithic database, but you want the saved
items to be user-specific you'll need to identify a record in a table with
the userid, or use the Registry. Global variables wouldn't be useful because
each user would start a new session. Database properties would be a bit more
difficult to identify by user.

Start with Help: Public variables, CreateProperty, GetSettings,
SaveSettings. I'd guess you are already familiar with tables, fields, and
accessing them.

Larry Linson
Microsoft Access MVP
My goal is to have two dates reappear when the form is
reopened. The values will have to be stored in a table to
be able to recall them - the database will closed often.
When would be the event to use or should I have it fire
from the exit cmd button on form?

Here is what I wrote, but I am having some problems:

Dim strSQL, strStartDate, strEndDate As String
Dim FRM As Form_frmMainMenu
Dim adoRsSetNumber As New ADODB.Recordset
Dim adoCon As New ADODB.Connection

With adoCon
.Open CurrentProject.Connection
End With

strSQL = "Select * from tblInformationTracking"
adoRsSetNumber.Open strSQL, adoCon

With FRM
adoRsSetNumber.Fields("storedBegDate")
= .txtStartDate.Value
adoRsSetNumber.Fields("storedEndDate")
= .txtEndDate.Value
adoRsSetNumber.Update
End With

End Sub

I am not able to get the values from the form -
.txtStartDate.Value. This fails and reports Object
varible or with block not set.

The sub above, once fixed, will store the values in a
table. Now, should I use the On Open of the form to call
another sub that will retrieve the stored values and how
do I put them in fields on the screen?

Thanks, RickCass
 
Back
Top