Results 1 to 3 of 3

Thread: Append query

  1. #1
    Join Date
    Sep 2005
    Posts
    29

    Unanswered: Append query

    I think i need to use an append query for this but have never used on before so just need to know if it is the right thing to do.

    I have two tables [tblPoles] and [tblPoleInstructions].

    I have a form set up for [tblPoles] so the user can enter the data required. One piece of data required is a start date. The only fields the tables have in common are the PK which is the Pole Number and the start date.

    I want the user to be able to enter the start date on the form for tblPoles and it to be automatcially entered into tblPoleInstructions. Is an append query the right way to do this?

    Any help would be greatly appreciated.

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    I wouldn't do it that way, but it certainly is a legitimate way to do it. I would do it in VBA, as follows:

    I'm assuming you're using DAO. For ADO, just leave off the "DAO." in the Dim statement.

    Code:
    Dim rst As DAO.Recordset
    
    Set rst = CurrentDB.OpenRecordset("tblPoleInstructions", dbOpenTable)
    With rst
        .AddNew
        !TableDateFieldName = Me.FormDateFieldName
        .Update
        .Close
    End With
    I would put this code in the Form's AfterUpdate event.

    Sam

  3. #3
    Join Date
    Sep 2005
    Posts
    29
    Thanks I've figured this out now

Posting Permissions

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