Keeping data available in data entry mode

Canedo

New member
Local time
Today, 18:42
Joined
Oct 20, 2002
Messages
7
I have a main customer form set to DataEntry as I want a certain group of users to enter customer information, but not see the whole customer database once entered or whilst entering.

The forms have a few additional forms linked by customerID. Some of these are opened from command buttons on the main form and others are subforms within the main customer form. I know as default, as soon as a form is closed, information is saved and disappears from view.

To make it easier for users I have added some save/cancel options. These operate in BeforeUpdate on the main Customer form, in OnClick for the command buttons opening linked forms, and in OnClick for a command button closing the main Customer form.

I am trying to keep the data in the main customer form available until it is closed.

To force a save without closing the form I have the following before the save code:

If Me.Dirty = True Then
Me.Dirty = False

This certainly keeps the data in the main customer form in view. However, I am not able to subsequently add any additional data or amend existing data already input. The fields are locked.

This also occurs if I tab through one of the subforms on the main customer form (even if no data is entered in one of these subform).

Could someone please provide some help on how I can get to a solution.

Thank you.
 
Have you tried using

DoCmd.RunCommand acCmdSaveRecord

this forces the record to be saved but I do not know if it will preserve the existing records
 
Fizzio,

Thanks for replying. Unfortunately, the code does not preserve the records. The records are still locked.

Any further help from the forum would be appreciated.
 
What code do you currently use behind your save button? Have you tried the docmd..... without the me.dirty.....?
 
DoCmd.RunCommand acCmdSaveRecord

- is the correct way to save a record and it does not have any "bad" side effects. Make sure that you have no other code that is causing the locking problem.

"If Me.Dirty = True Then
Me.Dirty = False "

- is "cute" code that happens to have the side effect of saving the current record. Why use an obtuse method when you can use a clear method?
 
Thanks both for getting back.

My save code is (with a module):

Dim strMsg As String
strMsg = "Data has changed."
strMsg = strMsg & "Do you wish to save the changes? "
strMsg = strMsg & "Click Yes to save or No to discard changes. "
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then
'do nothing
Else
DoCmd.RunCommand acCmdUndo

'For Access 95, use DoMenuItem instead
'DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If

For this type of user, it would be ok to just save records and not give the save/cancel options. But I would not like the records to be locked until the customer form is closed.

I can certainly get records to save using: ‘DoCmd.RunCommand acCmdSaveRecord’. But once saved the records are locked. Removing the 'Dirty code' makes the Customer form blank, and none of the records entered can be viewed.

The only other code I have identifies blank mandatory fields and takes the focus to these fields. This runs before any save or other code.

Any further help would be appreciated.
 
You seem to be sort of defeating the object a bit by setting the form to Data Entry only but allowing users to review the recently entered records.

A workaround to this is not to set the form to data entry but merely populate the form with a filtered recordset ie via a query. Include a date created / date modified field to the record then use this field to set your criteria for the records. You could even filter by user (if you store this information) and this will give you control of the recordset but still allowing review of currently entered records.

This may not be the solution you have hoped for but it would be fairly easy to implement.
 

Users who are viewing this thread

Back
Top Bottom