Results 1 to 9 of 9
  1. #1
    jagalletta is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    6

    Question Is it possible to create new input objects on a form during runtime?

    I have the following form:







    Is it possible to have the form duplicate each data entry object when the + button is clicked at the bottom right of each 'subform' (not actually subforms)?


    I have some data entry that I'd like to manage in this manner. I'd like to be able to make a flexible entry form for this data and hopefully, I can get to the point where clicking either of the + buttons will add another "record" for each "subform." This seems like its going to be code-heavy, but I am prepared and have the time, if this is possible. All I need to know is whether it is possible and how to do it.


    If you have some sort of other profound method of accomplishing what I'm trying to do, please feel free to share. Hopefully you can imagine the details of what I'm trying to accomplish. Perhaps its a design flaw? Someone please help! It's been a year since my last project and I'm a little rusty.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,600
    This is not creating new 'input objects', sounds like record navigation.
    Is this a form/subform arrangement? The pest info is a subform? The Notes is another subform? They are set for single view? You want the -+ to navigate records? You are replacing the intrinsic navigation bar with your own custom controls. This can be done but gets tricky because have to deal with the EOF and BOF errors. The intrinsic navigation bar handles that automatically.

    Review http://p2p.wrox.com/access-vba/4647-...n-buttons.html
    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
    jagalletta is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    6
    This is the answer I was looking for:

    Code:
    CreateControl,  CreateReportControl Methods Example
     The following example first creates a new form based on an Orders  table. It then uses the CreateControl method to create a text box control  and an attached label control on the form.
    Sub NewControls()
        Dim frm As Form
        Dim ctlLabel As Control, ctlText As Control
        Dim intDataX As Integer, intDataY As Integer
        Dim intLabelX As Integer, intLabelY As Integer
    
    
        ' Create new form with Orders table as its record source.
        Set frm = CreateForm
        frm.RecordSource = "Orders"
        ' Set positioning values for new controls.
        intLabelX = 100
        intLabelY = 100
        intDataX = 1000
        intDataY = 100
        ' Create unbound default-size text box in detail section.
        Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", _
            intDataX, intDataY)
        ' Create child label control for text box.
        Set ctlLabel = CreateControl(frm.Name, acLabel, , _
             ctlText.Name, "NewLabel", intLabelX, intLabelY)
        ' Restore form.
        DoCmd.Restore
    End Sub
    Thanks anyway.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,600
    Okay, sorry I misunderstood what you want but I don't understand why you want it. Why the need to create controls during run-time?
    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.

  5. #5
    jagalletta is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    6
    Well, please correct me if I'm wrong, but my access did not allow me to have a subform within a subform. Regardless of whether it would allow me, I highly dislike having the only view options being single form, continous, or datatable. I like the more user friendly form I've created, and hopefully I will be able to replicate each "subform" on the form much like an online shopping cart -- where you can specify size, color, etc. add another item, and so on. Know what I mean?

  6. #6
    jagalletta is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    6
    Also, having custom controls eliminates the confusion new users face when presented with Access's native buttons. At least I was confused by them the first time I ever saw them. (|<, <, >, >|, >* -- not the easiest hieroglyphs to translate as a novice). We have yet to hire the people who will be using this form, so with that said, I am not willing to allow a computer illiterate person use a program that they are unfamiliar with, with the possibility that they could do things incorrectly. That is, I also disallow access to the back end, and only allow the user to perform functions that have been programmed by me to eliminate unpredictable errors.

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Oops, I was late posting.

    Custom navigation controls could be hidden, then made visible. I frequently create my own nav buttons.
    You can have sub-sub-forms.
    Have you tried the split window in Access2010? I have A2000, but I have seen the split window where there is a single form with a datasheet view on the bottom.
    Last edited by ssanfu; 12-18-2012 at 12:30 PM. Reason: changed the whole post

  8. #8
    jagalletta is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    6
    Yeah, the split view is nice for seeing your past entries/current entries but It's not exactly what I'm trying to accomplish. I think I'm good for now, though. I'll attempt subform in a subform, but I was having issues with keeping all records visible at once. Maybe continuous view for both subforms would be best? I'll test a few things out and let you know if I get anywhere.

  9. #9
    jagalletta is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    6
    This is why I want to do it:


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

Similar Threads

  1. Replies: 5
    Last Post: 08-07-2012, 11:14 AM
  2. Replies: 1
    Last Post: 02-23-2012, 12:02 PM
  3. To put objects in Sheet Form cells
    By mazzanrol in forum Forms
    Replies: 2
    Last Post: 11-30-2011, 03:41 AM
  4. Objects on the form
    By injanib in forum Forms
    Replies: 2
    Last Post: 03-19-2011, 01:48 AM
  5. Replies: 2
    Last Post: 08-09-2010, 06:34 AM

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