Results 1 to 12 of 12
  1. #1
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164

    Create a command button (New record in Sub form)

    Hi,



    Is it possible to create a button for a new record within the sub forms?

    Ideally I would like to have one for each sub form and not add a new record to the main form. (Hide the record selectors)
    Attached Thumbnails Attached Thumbnails uploadfromtaptalk1431712712306.jpg  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Can set the subform as Continuous and arrange controls to look like datasheet then put button in header section.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Not really sure what you mean by "...and not add a new record to the main form..." but you realize that the Records added to the Subforms will have to be related to the Current Record on the Main Form, right?

    Triggering an action, in a Subform, can be done as June7 has advised, with a fair amount of grunt work, tweaking a Continuous Form to look like a Datasheet, or you can simply use the DoubleClick event of one or more Textboxes to act like a Command Button.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Thanks for the replies,

    Just to clarify, The Main Form has a 2 subforms within it, FrmShortage Main Form.

    The ShortageID field (Parent) links to each sub folders and their tables.

    the idea is the operative opens a new form record (Shortage record main form) and there are many Inbound shortages from various sites and an Outbound Shortages sub form for many Outbound shortages.

    At the moment the user can select the new record selector on either Sub Form and get straight to the bottom of the list to a new record, I was hoping to keep the Datasheet view I have at the moment with a command button to perform that function and get rid of the selector controls.

    Thanks for your help
    Attached Thumbnails Attached Thumbnails DS.jpg   DS2.jpg   DS3.jpg  

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Did you try suggestion?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Click image for larger version. 

Name:	DS4.jpg 
Views:	11 
Size:	145.1 KB 
ID:	20740Click image for larger version. 

Name:	DS5.jpg 
Views:	11 
Size:	94.6 KB 
ID:	20741

    Hi June,

    I have set the sub form to continuous and moved the controls and labels to horizontal.

    However the form now looks a little strange and the drop downs look weird,maybe I have done it wrong or got the wrong idea?

    Apologies as I am still learning.

    Thanks

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Try resizing height of controls.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164

  9. #9
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Thanks again June7, that has done the trick just as you said!!

    I now need to find a way to shape the form to look better so you can read the information box and that the combo fields don't look strange.

    Click image for larger version. 

Name:	DS6.jpg 
Views:	11 
Size:	95.3 KB 
ID:	20742

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The Information box should show a vertical scroll bar when it gets focus and input wraps to multiple lines.

    What is strange about the comboboxes?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by djspod View Post

    ...I now need to find a way to shape the form to look better so you can read the information box and that the combo fields don't look strange...
    As I said

    Quote Originally Posted by Missinglinq View Post

    ...Triggering an action, in a Subform, can be done as June7 has advised, with a fair amount of grunt work...
    With the emphasis being on with a fair amount of grunt work; it does take quite a bit of tweaking to make a Continuous Form look like a Datasheet Form! Or, as I also said, you can keep your current Datasheet Form and simply tell your users to Double-Click on a given Textbox to add a New Record, with code like this, for each 'triggering' Textbox:

    Code:
    Private Sub InboundShortagesTextbox_DblClick(Cancel As Integer)
      DoCmd.GoToRecord , , acNewRec
    End Sub

    If desired, you could set up this same thing for several Textboxes, if that would make it easier on your users, instead of just one Textbox.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  12. #12
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Thanks for your help Missinglinq

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

Similar Threads

  1. Replies: 2
    Last Post: 04-02-2015, 08:04 PM
  2. Replies: 6
    Last Post: 12-30-2014, 10:05 PM
  3. Replies: 5
    Last Post: 11-21-2013, 09:30 AM
  4. Replies: 2
    Last Post: 05-11-2012, 11:52 AM
  5. Replies: 7
    Last Post: 01-12-2011, 01:41 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