Clear only partial data on Form...

O

Os

I have multiple cbos on the form for:(date, shift,
product, dept, line, etc.) Each dept has between 12-18
lines. The user will enter values for scheduled and
actual productivity performance each day/shift. I'd like
to make it more user friendly; Now Access will clear the
entire form once you save the record to main tbl in the
dB. Instead of having the user to select the same date,
shift, dept over and over again, I'd like it to be able
to leave some of the cbos values after saving the record.
Because the user doesn't need to change anything other
than the "Line" number plus the scheduled/actual values.
Once they done with that particular "Dept" then they can
clear the form and so on...
Can any one help on how can I accomplish this?

Many thanks.
 
A

Alicia

What event is causing Access to clear the form? Could you in that event or
some event that happens before that event grab the values in the boxes into
some local variables in the code and then put them back in the boxes after
the clearing happens. If it's getting cleared because the form is closing
maybe you could set up a small table to hold the values until the form is
opened again? Need more information.
 
O

Os

And how do I do that?!

Yes, when the user tries to enter a "new record" Access
will automatically save the current record and then clear
the entire form.

Thanks.
 
A

Alicia

If you only have a few fields that you want to repopulate you could have the
afterUpdate event for each box save the values in a global variable. (It's
best not to over use global variables.) Global variables would be stored in
a general module not the form module. So for example if you wanted to store
the values from a combobox...
===== Sample ========
Private Sub cmbShift_Change()
On Error GoTo Err_cmbShift_Change
gstrShift = cmbShift.value
Exit_cmbShift_Change:
Exit Sub
Err_cmbShift_Change:
MsgBox Err.Description
Resume Exit_cmbShift_Change
End Sub
===== End Sample ======
then in the onCurrent event for the form
have it fill in all the boxes.
cmbShift = gstrShift
and add a button to clear the form in the click
event for the clear button just put stuff like
cmbShift = "" 'or something like that
 
O

Os

Thanks.

I will try that.

-----Original Message-----
If you only have a few fields that you want to repopulate you could have the
afterUpdate event for each box save the values in a global variable. (It's
best not to over use global variables.) Global variables would be stored in
a general module not the form module. So for example if you wanted to store
the values from a combobox...
===== Sample ========
Private Sub cmbShift_Change()
On Error GoTo Err_cmbShift_Change
gstrShift = cmbShift.value
Exit_cmbShift_Change:
Exit Sub
Err_cmbShift_Change:
MsgBox Err.Description
Resume Exit_cmbShift_Change
End Sub
===== End Sample ======
then in the onCurrent event for the form
have it fill in all the boxes.
cmbShift = gstrShift
and add a button to clear the form in the click
event for the clear button just put stuff like
cmbShift = "" 'or something like that



.
 
Top