Results 1 to 4 of 4
  1. #1
    bezoomnyveshch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    5

    GoToControl Subform

    Hi all,



    I'm helping out with a database and running into some issues with one of the requests they have.

    There is a navigation form with a tab for a data entry form. Within the data entry form, there is a subform with two columns (date_entered and donation_amt) that adds records to a donation table.

    At the top, there is a barcode entry control that relates the entry to a particular home address. I am trying to implement GoToControl so that after updating the barcode, the cursor goes automatically to donation_amt. Then, after entering the donation amount, the cursor should go from that subform to the barcode control.

    However, I'm only able to use GoToControl by referencing the subform the related table for some reason, even though it is a subform that is embedded. I then cannot use GoToControl to jump to anything outside of the subform. Hopefully that makes sense, it's a little hard to explain.

    Here is the structure:

    frmSTARTHERE
    frmDonation_Entry_Residential
    subfrmDonations_Residential
    tblDonations_Residential

    If you'd like to take a look, I have attached the database with dummy data here. I'm not sure of who set this database up since I'm helping out as a favor and by no means a professional, so thank you for all your help!
    CHFD Solicitation Database.zip
    Last edited by bezoomnyveshch; 12-06-2016 at 08:58 AM.

  2. #2
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You should always post what you've tried that doesn't work. I'll take a stab at it, but could be suggesting something you've already tried. The cause may be you are not using the proper syntax for referencing subform controls. There is a hierarchy for this. It is
    [Forms]![Main form name]![subform control name].[Form]![control name on subform] Note: subform control name is NOT about the name of the subform; rather it is the name of the control that contains the subform. Too often, Access wizards give form/report controls the same name as fields or subform controls the same name as the subform. If your control and subform have the same name, so be it, but one should always fix this duplication that the wizard creates.

    I don't use macros, and since the GoToControl is a macro action, I presume you are. In that case I believe your action will apply to the object that has the focus, which in your case might be the parent form. You can try the syntax I provided where it asks for the control you want to move to, substituting your own object names and see if it works. If the fact that the parent form has the focus is an issue, you can use the RunCode action to execute a little sub in a standard module:
    Public SetTheFocus ()
    [Forms]![Main form name]![subform control name].[Form]![control name on subform].SetFocus
    End Sub
    If that works, you could replicate it for any control on that subform as needed.

    PS: if you need to post a db, you have to zip it. You should compact/repair your db before doing so. Usually that gets the size down to where you can post it.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    bezoomnyveshch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    5
    Thanks for your response! I have added the database

    So far, I tried the GoToControl macro and was only able to activate the subform as a "table subform" and got stuck. I tried putting the entire reference to the subform in the macro, but it kept telling me that either the control or the subform doesn't exist. It's strange, because in the form itself, I can get everything to work, but it fails to find the subform once I click on it from the navigation form.

    In any case, I have added the database (with dummy data) to my original post with your helpful suggestion. I will try using that syntax in the meantime.

    I apologize for any lack of detail, I kind of had this thrown at me and I am doing it as a favor with no professional and little personal experience.

  4. #4
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    but it fails to find the subform once I click on it from the navigation form.
    As noted, the macro action applies to the object which has the focus at the time. That happens to be your main form as I said. If you have any real estate on the subform, try putting a button there and running the macro from that button click to see if that's the issue. As for the 'does not exist' message, I'm not surprised that it couldn't resolve the reference but I thought it was worth a try. Again, I very rarely do anything with macros. In fact, the only time I seem to bother with them is when trying to help out others in this forum!
    Sorry, I can't open your version. If you want to try creating an mdb version and posting that too, I'll try again. Otherwise, someone with a newer Access version might step in.

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

Similar Threads

  1. Replies: 1
    Last Post: 12-05-2016, 02:23 PM
  2. docmd.gotocontrol after undo
    By JeroenMioch in forum Forms
    Replies: 7
    Last Post: 08-19-2013, 12:47 PM
  3. GoToControl and SetFocus question
    By bgephart in forum Forms
    Replies: 5
    Last Post: 08-29-2012, 12:10 PM
  4. Help with gotocontrol, activecontrol
    By k9drh in forum Forms
    Replies: 5
    Last Post: 04-21-2011, 10:12 AM
  5. Issues with DoCmd.GoToControl
    By RaMcHiP in forum Programming
    Replies: 1
    Last Post: 05-09-2009, 08:56 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