Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2005
    Posts
    23

    Unanswered: Shouldn't this be simple (UPDATE RECORD)

    Hi,

    I can't believe I am having this problem but I am. I have 2 tables.

    Table 1: Customer Records
    Table 2: Policy Records

    This is how it looks in the form:

    ID Name Project Policy
    1 dbplus 001 General

    ID, Name and Project fields are in the parent table. ID is autonumber. Policy is in the child table (foreign link ID -- ref integ)

    My problem is only when I add a new record. When I add a record and update in the form Name and Project everything is ok. When I go to add Policy my script has trouble.

    It looks for the current record ID number in the parent table. This has not been established because the record is not "UPDATED".

    Since on the form the child table and the parent table data are merged the record does not advance and update until both are updated.

    So what I need is an update on the parent table before it advances to the Policy Field. AfterUpdate on the Policy field initializes the script and fails because ID (Autonumber) has not been updated.


    I thought that this would be simple with a simple UPDATE command but it is not working.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    See if forcing the record to save helps:

    DoCmd.RunCommand acCmdSaveRecord

    or

    If Me.Dirty Then Me.Dirty = False
    Paul

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're not trying to save records into two tables at the same time are you?

    Normally, the parent table would be in a mainform and the child table fields would be in a subform on the mainform. Is this what you are doing? Sure doesn't sound like it!
    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
  •