Results 1 to 3 of 3
  1. #1
    smahdih is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    52

    save record in 2 table

    hi
    i want 2 table

    table1:

    OrderCode
    OrderDate
    LeadTime


    .
    .
    .

    Table2:

    OrderCode
    ID

    I want when fill a record in table1 at the same time OrderCode in table2 muts be written exat OrderCode in table1

    How do this?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,602
    What is table 2 for - order details? One way is to use form/subform arrangement. Main form bound to table 1, subform bound to table 2. Master/Child links set to the OrderCode fields. As soon as you enter a value into the subform record, the subform OrderCode foreign key field will populate. Anything else will require code, I use only VBA, not macros.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Nov 2011
    Posts
    5
    Hi,
    Make form, link it to table1
    Put command button on it.
    Behind the Command button put some code like this
    Dim Idb As Database
    Dim irq As Recordset
    Dim Isql As String

    Isql = "Select * from table2"
    Set Idb = CurrentDb
    Set irq = Idb.OpenRecordset(Isql, dbOpenDynaset)

    irq.AddNew
    irq("ColumnName") = Me.txtTextBoxName
    irq("ColumnName") = Me.txtTextBoxName
    irq("ColumnName") = Me.txtTextBoxName
    irq("ColumnName") = Me.txtTextBoxName
    irq("ColumnName") = Me.txtTextBoxName
    ''''
    '''
    irq.Update
    Set Idb = Nothing
    Set irq = Nothing
    Isql = ""


    I hope it help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. On Add record, how do I force a Save first?
    By KathyL in forum Programming
    Replies: 11
    Last Post: 07-18-2011, 12:37 PM
  2. Replies: 8
    Last Post: 05-12-2011, 06:11 PM
  3. Replies: 9
    Last Post: 01-20-2011, 02:22 PM
  4. Duplicate Record Cannot Save
    By magicscreen in forum Programming
    Replies: 2
    Last Post: 09-15-2010, 08:15 AM
  5. save last record in table through a form
    By ajetrumpet in forum Forms
    Replies: 3
    Last Post: 09-09-2010, 08:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums