Results 1 to 15 of 15
  1. #1
    MarcoPolo is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    10

    Listing forms in table vba

    Hello,
    I want to last all new created forms in table "MyForms"
    I am struggling with the folowing

    By Example I already have 4 formnames in tblMytable
    form1
    form2
    form3
    form4

    After adding several new forms in my database i want to add these new forms by vba code without deleting the excisting forms in the tblMytable?
    The existing forms in the table may not beeing deleted for not loosing additional information in another field.

    Thanks.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2021
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Just curious. Why would you want/need a table for the form names.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    MarcoPolo is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    10
    Hello Bob, Thanks for your supply..
    I am programming databases for a long time,
    Considering a database with quite a lot of forms, this database needs to be adjusted to a bilingual database Dutch and English.
    The table with the form names and information is for the follow-up which forms have already been processed and additional information.
    Marc Vermeersch.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,551
    I would walk the system file MsysObjects and look for the Form type value.
    I am not at my computer at the moment, but a quick Google should give you what you want, along with Reports/Queries etc?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,928
    Since to do something like making a form bilingual will involve modifying the underlying module - and presumably there will be common functions or calls (or include a comment) have you considered looping through the module collection or allforms to find the function name or comment?

  6. #6
    MarcoPolo is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    10
    Thanks for your reply,
    The translation of the forms labels and buttons already works perfectly.
    Only my question is to make a list of the forms in a table

    After adding several new forms in my database i want to add these new forms by vba code without deleting the excisting list of forms in the tblMytable?
    The existing forms in the table may not beeing deleted for not loosing additional information in another field.

  7. #7
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,928
    I guess I don't understand - what is wrong with using an append query? Or is the question about trying to identify new forms?

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,551
    Quote Originally Posted by MarcoPolo View Post
    Thanks for your reply,
    The translation of the forms labels and buttons already works perfectly.
    Only my question is to make a list of the forms in a table

    After adding several new forms in my database i want to add these new forms by vba code without deleting the excisting list of forms in the tblMytable?
    The existing forms in the table may not beeing deleted for not loosing additional information in another field.
    So a simple DCount() would determine whether you add a form or not?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #9
    MarcoPolo is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    10
    Its to appending the new formnames in the table

    By Example I already have 4 formnames in tblMytable

    tblMytable
    FORMNAMES | Done | Information |
    form1
    form2
    form3
    form4


    I'm getting the formnames see code below

    For Each frm In CurrentProject.AllForms
    Debug.Print frm.Name

    I need to add the new forms in tblMytable without deleting data in tblMytable
    so i need to append the formnames that is not present in the list.

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,551
    And the question is?

    You would use a INSERT query statement.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #11
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,928
    Not clear why you need two tables (MyForms and tblMyTable) or since you have two tables you are concerned about deleting the existing forms in tblMytable when you are adding new forms to MyForms but based on the info provided in post #1 perhaps

    Code:
    INSERT INTO MyForms ( frmName )
    SELECT frms.Name
    FROM (SELECT Name
    FROM msysobjects
    WHERE Type=-32768)  AS frms LEFT JOIN tblMytable ON frms.Name = tblMytable.formName
    WHERE tblMytable.formName Is Null
    You can easily convert the sql to be executed in vba

  12. #12
    MarcoPolo is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    10
    some help for vba code to fill the list in the table
    insert querry or code dao

  13. #13
    MarcoPolo is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    10
    Thanks,
    Seems to approach my question,
    I have only 1 table "tblMytable" to fill the missing formnames FROM msysobjects


  14. #14
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,551
    Quote Originally Posted by CJ_London View Post
    Not clear why you need two tables (MyForms and tblMyTable) or since you have two tables you are concerned about deleting the existing forms in tblMytable when you are adding new forms to MyForms but based on the info provided in post #1 perhaps

    Code:
    INSERT INTO MyForms ( frmName )
    SELECT frms.Name
    FROM (SELECT Name
    FROM msysobjects
    WHERE Type=-32768)  AS frms LEFT JOIN tblMytable ON frms.Name = tblMytable.formName
    WHERE tblMytable.formName Is Null
    You can easily convert the sql to be executed in vba
    Is there any need?, you could just execute that as a saved query?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  15. #15
    MarcoPolo is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    10
    Hello,
    I just has test the insert query, and this work perfect.
    Many thanks..

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

Similar Threads

  1. Replies: 3
    Last Post: 09-20-2017, 06:54 PM
  2. Replies: 4
    Last Post: 02-04-2017, 09:55 PM
  3. Replies: 3
    Last Post: 03-23-2012, 06:16 AM
  4. Listing all items from a table in a form
    By Ddwinters45 in forum Forms
    Replies: 1
    Last Post: 01-13-2011, 03:29 PM
  5. One to Many Listing in Forms
    By zunebuggy in forum Forms
    Replies: 5
    Last Post: 05-11-2010, 08:12 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