Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Update 2 tables with one field?

Discussion in 'Information Technology' started by jlan, Jul 28, 2006.

  1. jlan

    jlan
    Expand Collapse
    Guest

    I have 3 tables, employee, timesheet and order. timesheet is linked by
    the employeeid field to employee table and by masternmbr to order
    table. The timesheet subform is the main data entry form where the
    employeeid is fed automatically once the employee name is selected from
    the employee main form. timesheet subform collects masternmber as input
    by a text field by whomever is entering the data. I would like the
    master number field input to the timsheet table (via the timsheet form)
    to simultaneously enter that master number into the order table (which
    has no input form). Is this possible?
    Thanks :)
     
  2. Loading...


  3. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    Do it in the afterInsert event of the subform

    Sub Form_AfterInsert()
    CurrentDb.Execute "INSERT INTO ORDERTABLE (masternmbr) VALUES(" &
    Me.masternmbr.Value & ")"
    End Sub

    HTH

    Pieter

    "jlan" <jason.langdale@gmail.com> wrote in message
    news:1153942099.007131.79210@h48g2000cwc.googlegroups.com...
    >I have 3 tables, employee, timesheet and order. timesheet is linked by
    > the employeeid field to employee table and by masternmbr to order
    > table. The timesheet subform is the main data entry form where the
    > employeeid is fed automatically once the employee name is selected from
    > the employee main form. timesheet subform collects masternmber as input
    > by a text field by whomever is entering the data. I would like the
    > master number field input to the timsheet table (via the timsheet form)
    > to simultaneously enter that master number into the order table (which
    > has no input form). Is this possible?
    > Thanks :)
    >




    --
    ----------------------------------------
    I am using the free version of SPAMfighter for private users.
    It has removed 4367 spam emails to date.
    Paying users do not have this message in their emails.
    Get the free SPAMfighter here: http://www.spamfighter.com/len
     
  4. jlan

    jlan
    Expand Collapse
    Guest

    I just can't seem to get that to work? Is there anything I should
    change?


    Pieter Wijnen wrote:
    > Do it in the afterInsert event of the subform
    >
    > Sub Form_AfterInsert()
    > CurrentDb.Execute "INSERT INTO ORDERTABLE (masternmbr) VALUES(" &
    > Me.masternmbr.Value & ")"
    > End Sub
    >
    > HTH
    >
    > Pieter
    >
    > "jlan" <jason.langdale@gmail.com> wrote in message
    > news:1153942099.007131.79210@h48g2000cwc.googlegroups.com...
    > >I have 3 tables, employee, timesheet and order. timesheet is linked by
    > > the employeeid field to employee table and by masternmbr to order
    > > table. The timesheet subform is the main data entry form where the
    > > employeeid is fed automatically once the employee name is selected from
    > > the employee main form. timesheet subform collects masternmber as input
    > > by a text field by whomever is entering the data. I would like the
    > > master number field input to the timsheet table (via the timsheet form)
    > > to simultaneously enter that master number into the order table (which
    > > has no input form). Is this possible?
    > > Thanks :)
    > >

    >
    >
    >
    > --
    > ----------------------------------------
    > I am using the free version of SPAMfighter for private users.
    > It has removed 4367 spam emails to date.
    > Paying users do not have this message in their emails.
    > Get the free SPAMfighter here: http://www.spamfighter.com/len
     
  5. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    if it's a textfield you have to add quotes - or maybe move it to the
    before_insert event
    Also Add dbFailOnError to get an error msg
    ie
    CurrentDb.Execute "INSERT INTO ORDERTABLE (masternmbr) VALUES( '" &
    Me.masternmbr.Value & "' )", dbFailOnError

    Haven't got access around at the moment

    HTH
    Pieter

    "jlan" <jason.langdale@gmail.com> wrote in message
    news:1153945250.863732.39150@h48g2000cwc.googlegroups.com...
    >I just can't seem to get that to work? Is there anything I should
    > change?
    >
    >
    > Pieter Wijnen wrote:
    >> Do it in the afterInsert event of the subform
    >>
    >> Sub Form_AfterInsert()
    >> CurrentDb.Execute "INSERT INTO ORDERTABLE (masternmbr) VALUES(" &
    >> Me.masternmbr.Value & ")"
    >> End Sub
    >>
    >> HTH
    >>
    >> Pieter
    >>
    >> "jlan" <jason.langdale@gmail.com> wrote in message
    >> news:1153942099.007131.79210@h48g2000cwc.googlegroups.com...
    >> >I have 3 tables, employee, timesheet and order. timesheet is linked by
    >> > the employeeid field to employee table and by masternmbr to order
    >> > table. The timesheet subform is the main data entry form where the
    >> > employeeid is fed automatically once the employee name is selected from
    >> > the employee main form. timesheet subform collects masternmber as input
    >> > by a text field by whomever is entering the data. I would like the
    >> > master number field input to the timsheet table (via the timsheet form)
    >> > to simultaneously enter that master number into the order table (which
    >> > has no input form). Is this possible?
    >> > Thanks :)
    >> >

    >>
    >>
    >>
    >> --
    >> ----------------------------------------
    >> I am using the free version of SPAMfighter for private users.
    >> It has removed 4367 spam emails to date.
    >> Paying users do not have this message in their emails.
    >> Get the free SPAMfighter here: http://www.spamfighter.com/len

    >




    --
    ----------------------------------------
    I am using the free version of SPAMfighter for private users.
    It has removed 4367 spam emails to date.
    Paying users do not have this message in their emails.
    Get the free SPAMfighter here: http://www.spamfighter.com/len
     

Share This Page