Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2008
    Posts
    3

    Post Unanswered: New Record, Some Info the Same

    Hello,

    I am hoping someone may be able to help me program Access correctly.

    I want the ability for the user to click on a checkbox, enter a new record, and after adding that record, have some of the same information already entered. If the checkbox is false, then the user will simply enter a new record, and all fields will remain blank for the next record.

    I did the following -

    Private Sub Name_Exit
    Data1 = Me.Name.Text
    End SUb

    Private Sub Form_AfterUpdate()
    If me.checkbox1.value = True Then
    Me.Name.SetFocus
    Me.Name.Text = Data1
    End if
    End Sub

    When I do this, it will not save the record.

    Any thoughts on what I should do differently? Thank you for your help.

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Data1 needs to be declared so that all procedures in the form can see it:

    Private Data1 ' <-- should be placed at the top of the code window.

    Once you do that, you should see some success since the Form_AfterUpdate() event will know what Data1 is.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Aug 2008
    Posts
    3
    Thank you for your help. I had originally tried:

    Dim Data1 as String

    I will try what you suggested.

    Thanks again.

  4. #4
    Join Date
    Aug 2008
    Posts
    3
    I got it to work!

    Thanks again!

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're most welcome
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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