Results 1 to 3 of 3
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Current record vs VBA and make record

    Currently for a new booking I have a many to many relationship that has the booking as the subform and the person (teacher table) booking as the main form.



    So you create the ID for the main form first when you open (data entry) then you click in the subform and it creates the ID's in the junction table and ID in the booking table

    However this causes problems if I need to undo the records (as they have been created).

    I want to be able to cancel or make

    If I program unbound text boxes on a form - can I have the information tied to variables, then use those to make a new record that goes across the junction like explained above? would it cause any errors?

    I am assuming I would create 3 new records (tblTeacher, tblJunction, tblBooking) and collect new ID for tblTeacher and tblBooking (which I don't know how to collect) and then put those two records into the newly created junction table to tie them all together - all done using VBA.

    That way any form information added to the booking would be only held in a variable until they have pressed save or cancel.

    Any recommendations?

    (also my next question is once I programme in to make a new record how to I get access to return that newly created record ID using VBA?)

  2. #2
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    Quote Originally Posted by Ruegen View Post
    Currently for a new booking I have a many to many relationship that has the booking as the subform and the person (teacher table) booking as the main form.

    So you create the ID for the main form first when you open (data entry) then you click in the subform and it creates the ID's in the junction table and ID in the booking table

    However this causes problems if I need to undo the records (as they have been created).

    I want to be able to cancel or make

    If I program unbound text boxes on a form - can I have the information tied to variables, then use those to make a new record that goes across the junction like explained above? would it cause any errors?

    I am assuming I would create 3 new records (tblTeacher, tblJunction, tblBooking) and collect new ID for tblTeacher and tblBooking (which I don't know how to collect) and then put those two records into the newly created junction table to tie them all together - all done using VBA.

    That way any form information added to the booking would be only held in a variable until they have pressed save or cancel.

    Any recommendations?

    (also my next question is once I programme in to make a new record how to I get access to return that newly created record ID using VBA?)
    http://support.microsoft.com/kb/304466

    Check out the part on "Referential Integrity" and "Cascading Updates and Deletes".

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by Xipooo View Post
    http://support.microsoft.com/kb/304466

    Check out the part on "Referential Integrity" and "Cascading Updates and Deletes".
    That's all good - I already have the many to many relationship.

    I want to change the way I currently add records in the database - currently I do it as described above but I want to switch it all to VBA to do the same thing.

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

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2014, 05:37 PM
  2. Replies: 16
    Last Post: 02-06-2013, 03:06 PM
  3. Replies: 3
    Last Post: 09-19-2012, 07:34 AM
  4. Replies: 5
    Last Post: 08-24-2012, 10:32 AM
  5. Replies: 3
    Last Post: 06-27-2009, 03:53 PM

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