Results 1 to 3 of 3
  1. #1
    MCCDOM is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    28

    Auto add default value to table joined to linked table

    Hi There,



    If I add a new record in one table is it possible to have a default value added to a joined table that uses the previous tables ID (Primary key) as the second tables foreign key?

    Example being if I add a name into tblName with the NameID being 1 can the other table (tblPassword) automatically add a new record with the foreign key (NameID) '1' and a default value in the password column as 'Add Password'

    Additional information: tblName is a linked table form another database. This saves me having to enter names twice into each database.

    I look forward to your solutions.

    Kind regards,

    Dom

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    you can put 'default' values in a FORM but not a table.
    when the form opens, in the FORM_ONCURRENT event, set the text box

    txtbox = me.defaultvalue

    you could also have a field in the table DEFAULT field.
    checkmark it. but users could check more than 1.

  3. #3
    MCCDOM is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    28
    Hi Ranman,

    Thanks for your reply. I've managed to find a way to achieve what I want but it might not be the best so if anybody does have another suggestion please do let me know. What I have done is use an unmatched query to run on the startup of the database form (Form_Load). This checks if tblName and tblPassword both contain matching NameID. If tblName has extras then it puts those extra NameID's into another table. Still on the form load event I run a DCount to check if the temporary table with the unmatched NameID's has any records. If it does an append query is run to put them into tblPassword.

    I've also changed the 'Default Value' for the password field of tblPassword to "Add Password" so whenever a new record is added that is automatically populated.

    Kind regards,

    Dom

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

Similar Threads

  1. Replies: 7
    Last Post: 09-26-2016, 08:53 AM
  2. Replies: 9
    Last Post: 10-20-2014, 04:00 PM
  3. Replies: 2
    Last Post: 04-15-2014, 10:03 PM
  4. Replies: 8
    Last Post: 10-03-2013, 08:11 AM
  5. Replies: 7
    Last Post: 08-18-2011, 02:18 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