Adding records to a new table based on form

Adding data to SQL from one table based on selection from another tabl

Page 1 of 1

1 Replies - 627 Views - Last Post: 28 May 2010 - 11:03 PM Rate Topic: -----

#1 pelizdr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 14-December 09

Adding records to a new table based on form

Posted 27 May 2010 - 12:01 PM

I have been poking at this all day. I have two SQL tables (SQL 2005), which I have linked via two fields (serial number and part number). These two tables are used in a form in Access 2007. I am trying to capture data in the second table for decisions about the first. This process works fine as long as the serial number and part number exist in the second table. What I am trying to do is add the serial number and part number to the second table FROM the first only when the user tries to input data.

If Me.[dbo_isd_lease2].[epserial_id] = Me.[dbo_isd sacd].[epserial_id] Then End
Insert into dbo_isd_lease2 ([epserial_id],[epprod_id]) VALUES (Me.[dbo_isd sacd.epserial_id],Me.[dbo_isd sacd.epprod_id])
End If



Be kind to the noob.

Is This A Good Question/Topic? 0
  • +

Replies To: Adding records to a new table based on form

#2 June7  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 104
  • View blog
  • Posts: 904
  • Joined: 09-December 08

Re: Adding records to a new table based on form

Posted 28 May 2010 - 11:03 PM

What error msg?

Remove the 'End' from the If line.

If the tables are linked, why do you have to use code to add values to the other table? One table is master and one child. If you create new record, the primary key values from master should automatically populate the child foreign key fields.

This post has been edited by June7: 28 May 2010 - 11:11 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1