Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Confused about settings (MS Access 2007)

    I'm a little bit confused about the combination of settings of AllowAddition, AllowDeletion, AllowEditon and DataEntry.
    I know that these settings can be set in the property window of the form, but about what kind of combination has to be made i have my doubts.
    Suppose that my form has four commandbuttons: cmdNew , cmdChange , cmdSave and CmdUndo..
    When the form opens for the first time, it has to be in read-only mode and the data of the last record from his recordsource has to be displayed.
    What kind of combination of settings has to be made in the property window of the form to make this read-only mode possible? Does these settings
    makes it superfluous to lock the controls on the form?
    What settings has to be made in the event procedure of the button CmdNew, so that the form goes from read-only moe to allowing enteing a new record,
    or are the necessary settings automatically set by firing the command to go to a new record ?
    What about these settings if the button cmdChange is clicked in order to make it possible to change data?
    The same question for what about the button CmdUndo, in order to go back to the last displayed record and that in read-only mode?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Confused about settings (MS Access 2007)

    Try the following settings:

    Allow Edits = No (user can't edit existing records; controls are locked in existing records)
    Allow Deletions = No (user can't delete existing records)
    Allow Additions = Yes (user can create a new record)
    Data Entry = No (user can view existing records)

    To go to the last record, use code in the On Load event of the form:

    Private Sub Form_Load()
    On Error Resume Next
    RunCommand acCmdRecordsGoToLast
    End Sub

    The cmdNew button only has to go to a new record:

    Private Sub cmdNew_Click()
    On Error Resume Next
    RunCommand acCmdRecordsGoToNew
    End Sub

    The cmdChange button must set Allow Edits to Yes:

    Private Sub cmdChange_Click()
    Me.AllowEdits = True
    End Sub

    cmdSave isn't necessary: records are saved automatically in Access.

    To return to go to the last record in read-only mode:

    Private Sub cmdUndo_Click()
    On Error Resume Next
    RunCommand acCmdRecordsGoToLast
    Me.AllowEdits = False
    End Sub

  3. #3
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Confused about settings (MS Access 2007)

    Thank you very much for the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •