Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page