Page 1 of 3 123 LastLast
Results 1 to 15 of 35
  1. #1
    petro62 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2022
    Posts
    45

    How to set new datarecord for tab control subform

    First I want to stipulate that I am new to Access so I apologize if some of my terminology is off.

    I have a access file that I am building for project tracking. A lot of the items in it are required from higher up. The way I created it was that I have it open up on a Main Menu. From that Main Menu the user either picks (add new project) or (Edit Existing).

    I am currently stuck on the add new.
    What I want it to do is to open up the tab control form (User Input) it then closes the Main Menu form and Set all 7 pages/tabs of the User Input form to a new record. It currently brings up the first record in the database.

    Code:
    Private Sub NewProjectButton_Click()
    
        DoCmd.OpenForm "User Input", acNormal, "", "", acAdd, acNormal
        Forms!"User Input".TabCtl0.DataEntry = True
        DoCmd.Close acForm, "Main Menu"
    
    
    End Sub
    Click image for larger version. 

Name:	user input.JPG 
Views:	36 
Size:	203.5 KB 
ID:	46980

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you should not have a subform for every tab, this can lead to memory problems.
    there should be 1 subform, then when user clicks the tab, it swaps out the source of the subform:

    Code:
    Private Sub TabCtl4_Change()
    Select Case TabCtl4.Value
      Case 0  '"Phones"
         subFrm.SourceObject = "frmPhones"
      Case 1  '"clients"
         subFrm.SourceObject = "frmClients"
      Case 2 '"Invoices"
         subFrm.SourceObject = "frmInvoices"
    End Select
    
    End Sub
    then start a new record at tab change.

  3. #3
    petro62 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2022
    Posts
    45
    Quote Originally Posted by ranman256 View Post
    you should not have a subform for every tab, this can lead to memory problems.
    there should be 1 subform, then when user clicks the tab, it swaps out the source of the subform:

    Code:
    Private Sub TabCtl4_Change()
    Select Case TabCtl4.Value
      Case 0  '"Phones"
         subFrm.SourceObject = "frmPhones"
      Case 1  '"clients"
         subFrm.SourceObject = "frmClients"
      Case 2 '"Invoices"
         subFrm.SourceObject = "frmInvoices"
    End Select
    
    End Sub
    then start a new record at tab change.
    Would you be able to explain this a bit more. so as you see in the picture I created a form for each tab and then I drug those forms over into the corresponding tab in the Tab Control. Are you say that the tabs are blank and that when the click the "Next" Button to go to the next tab I have the button use the code like you have above and it will load that form into that new tab/page? What if they just click the tab/page on top? I am just trying to understand. Thanks

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,557
    Hi

    I would recommend not using a Navigation Form.

    Best to create the Form manually.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  5. #5
    Minty is online now VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    You can't set a specific tab in a tab control to data entry.
    If the form on the tab control is a sub form you can obviously set the subform to data entry.
    You would refer to the subformcontrols form property.

    Read up here http://access.mvps.org/access/forms/frm0031.htm on how to refer to subform objects.
    Bookmark that page it's invaluable !

    Tabs controls are simply extensions of the same form, they are not different forms.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    I knew I had seen it somewhere else. , just searching on wrong site.
    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

  8. #8
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    I think this should work:
    Code:
    DoCmd.OpenForm "User Input", , , , acFormAdd
    'Forms!"User Input".TabCtl0.DataEntry = True
    Me.Visible=False ' usually you hide the Main Menu in case there are controls on it like user name that you need in other places, if not close it    DoCmd.Close acForm, "Main Menu"
    Are the subforms on the other tabs bound to the same Projects table, just different fields? if yes you do not need the subforms, just select all the controls on the subform(s), copy, delete the subform, click inside the tab and paste.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  9. #9
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I would high;y recommend you stop and fix the issues in the dB.
    You have not described what the dB is for except it is for "project tracking"; you just junp into what you are doing/trying to do.

    The issues I see,from what you have posted, are
    -> There are spaces in object names
    -> There is at least one reserved word as a field name ("Type")
    Better would be "ProjectType" or "Project_Type"

    -> There are special characters in field names ("CM#", "R&D Dev Checklist")
    Better would be "CMNum", "CMNumber", "CM_Num" or "CM_Number"
    Better would be "RD_Dev_Checklist"

    -> You are using macros.....



    Maybe you would post your dB? It would help to see what you are trying to do....



    And welcome to the forum.

  10. #10
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You guys are making the same points and asking the same questions as in the other thread. Because of the duplication and lack of commentary about the cross posting (here or there) I am out at both ends.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  11. #11
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    @Micron,


    Reminder to self:

    From now on.... READ cross posting link BEFORE posting response here...

  12. #12
    petro62 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2022
    Posts
    45
    I apologize for the cross posting. I didn’t really put any thought into the same users frequenting the same place. I just happened to find this forum and it seemed more active than the other as far as access went

    If I posted the database I would need to clear all the data. I could put some fake data in. So yeah I know I jumped into this without knowing any access so it seems a broke a fair amount of rules. Just trying to get it done. I didn’t imagine it would have taken this long when I followed advice to switch from excel to access. I will start with fixing the names as that seems one the first big issues.

  13. #13
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I apologize for the cross posting.
    But did you read the article at the link? It puts it all into perspective in a nice way, so you really should. It doesn't matter if anyone who answers you belongs to other forums - the time wasted on covering the same ground is the same regardless. Cross posting is OK, just follow the guidelines per the article. I could go on but I'll leave it at that except to say I'm encouraged by what you said.

    Access has a big learning curve - much steeper than Excel I'd say. You could try randomizing data or take the manual route.
    You could see post 2 here for a set of links I recommend for novices

    https://www.accessforums.net/showthr...ighlight=names
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  14. #14
    petro62 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2022
    Posts
    45
    Thanks. I will read up on those tonight and tomorrow morning. I can also put some random data on there. I am starting to think it may be worth starting fresh and trying to break my large table down into sections similar to how I have that user input form but we will see after I read up on the link you posted.

  15. #15
    petro62 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2022
    Posts
    45
    Quote Originally Posted by Micron View Post
    But did you read the article at the link? It puts it all into perspective in a nice way, so you really should. It doesn't matter if anyone who answers you belongs to other forums - the time wasted on covering the same ground is the same regardless. Cross posting is OK, just follow the guidelines per the article. I could go on but I'll leave it at that except to say I'm encouraged by what you said.

    Access has a big learning curve - much steeper than Excel I'd say. You could try randomizing data or take the manual route.
    You could see post 2 here for a set of links I recommend for novices

    https://www.accessforums.net/showthr...ighlight=names

    I had to zip the access file for it to fit, but there it is with a few rows of data. Still reading through all the other additional links and will keep working on this during the weekend.

    Project Dashboard4.zip

Page 1 of 3 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-15-2018, 02:33 PM
  2. Replies: 8
    Last Post: 06-19-2015, 02:19 AM
  3. Replies: 10
    Last Post: 02-20-2013, 07:04 AM
  4. Replies: 3
    Last Post: 03-29-2012, 12:40 PM
  5. Replies: 5
    Last Post: 10-13-2011, 03:36 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