Results 1 to 4 of 4
  1. #1
    sandordan is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2018
    Posts
    6

    how to add "SubdatasheetName" to a Access table and then change it?

    Hi Everyone,



    I try to set a subtable (tbl2) to tbl1 connected with "ID_Nr", but receive an error code: 3385 Description: User-defined properties do not support a Null value. How should I set the subtable and set the connection?


    Code:
    Sub set_SubdatasheetName()
    
    Dim db As DAO.Database
    Dim tbl As DAO.TableDef
    Dim ppty As DAO.Properties
    
    
    
    
    Set db = CurrentDb
    Set tbl = db.CreateTableDef("tbl1_name")
    Set tbl2 = db.CreateTableDef("tbl2_name")
    
    
    
    
    Set ppty = tbl.CreateProperty("SubdatasheetName", dbText, tbl2)
    tbl.Properties.Append ppty
    
    
    Set ppty = tbl.CreateProperty("LinkMasterFields", dbText, "ID_Nr")
    tbl.Properties.Append ppty
    
    
    Set ppty = tbl.CreateProperty("LinkChildFields", dbText, "ID_Nr")
    tbl.Properties.Append ppty
    
    
    
    
    
    
    Set db = Nothing
    Set tbl = Nothing
    Set ppty = Nothing
    
    
    End Sub


    Thank You!

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    I know a lot but not every error code description - would help if you stated the error description - but my guess would be tbl2 needs to be surrounded by quotes

  3. #3
    sandordan is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2018
    Posts
    6
    Hi, If I tried it with quotes previously and didnt run.

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412

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

Similar Threads

  1. Simple table relationships ("faces" to "spaces" to "chairs")
    By skydivetom in forum Database Design
    Replies: 36
    Last Post: 07-20-2019, 01:49 PM
  2. Replies: 1
    Last Post: 09-18-2017, 06:53 PM
  3. Replies: 3
    Last Post: 04-20-2016, 02:50 PM
  4. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  5. Replies: 30
    Last Post: 09-27-2013, 01:34 PM

Tags for this Thread

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