One-To-One Relationship

  • Hey all. Access 2003 front with SQL Server 2000 back-end.

    I have a Customer table and I just created a new table that is one-to-one with the Customer table, let's call it CustomerInfo just to give it a name.

    I have a form used for customer management whose row source is the Customer table. With my new one-to-one relationship, when I use my customer management form to create a new Customer record, I need to immediately create a new CustomerInfo record with the same PK as the Customer table, and I need that CustomerInfo data to be accessible and updateable on my customer form.

    What's the best way to do this?

  • How are you interfacing with your backend? Are you using pass through queries or ADODB recordsets or what?

    ---
    Dlongnecker

  • Well for the most part, with my forms, I'm just using the form and control properties and setting row and control sources. Even in VBA form events, I try to refer to my form controls if I have to set any values programmatically.

    If I need to run ad hoc sql, usually I use DoCmd.RunSQL. If I need data back, ADODB recordset.

  • I am confronting the same problem and don't really know how to solve this. I think you can use trigger queries, but haven't really looked too far into this.

  • Well I think I figured it out, on my own.

    I made my new table the source of a subform, and then bound the appropriate column between the parent form and the subform, and the trick was to allow inserts on the subform (ensuring that the form view is "single record" or whatever it's called). In this way, Access handled all the work.

    I did, however, have to make an "On Delete" event in the parent form that manually deleted the subform record.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply