Results 1 to 8 of 8
  1. #1
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142

    Set focus in sub form

    I have a main form [frmTransactions] containing a sub form [fsubOfficeSuppliesCatBre]
    I want to open the form go to the sub form and set the focus to the [CatBreBrand] fieldin the sub form.
    I tried thefollowing code, with the resulting error message?

    DoCmd.OpenForm "frmTransactions",acNormal, "", "", , acNormal
    DoCmd.GoToRecord acForm,"frmTransactions", acLast
    Me.fsubOfficeSuppliesCatBreak.SetFocus
    Me. fsubOfficeSuppliesCatBreak!CatBreGrocBrand.SetFocu s

    ****************************************
    Error


    CompileError
    Method orData Member Not Found
    ****************************************
    What am I doing wrong ????

  2. #2
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    ok
    DoCmd.OpenForm "frmTransactions", acNormal, , , , acNormal
    DoCmd.GoToRecord acForm, "
    frmTransactions", acLast
    Forms![
    frmTransactions]![fsubOfficeSuppliesCatBre].Form![TableNumber].SetFocus
    DoCmd.Close acForm, "
    frmTransactions", acSaveYes

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Me.fsubOfficeSuppliesCatBreak.Form.SetFocus

    Be sure to use the Subform Container name and not the name of the Form object itself.

  4. #4
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142
    Still no luck
    It close's the [frmTransactions] so I omitted the last line and I inserted [CatBreBrand] in your [TableNumber] shown above it just opens in the first field of [frmTransactions]. I want to keep the [frmTransactions] open and go to the sub form within it [fsubOfficeSupplies] then set the focus to the CatBreBrand field about 50% of the way down??????

  5. #5
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142
    Maybe I should explain the process, it may help.
    1. Transactions are entered as a gross number for financial accounting etc
    2. A sub form is visible in the Transaction form when certain criteria are met
    3. If it is a new product / service then details of the style are entered i.e. by box, by kilo, etc. through a pop up which closes the transaction form
    4. When details are entered in the pop up then a button is clicked to close the pop up and return to the last transaction form.
    5. The Transaction form re-opens at the last record, showing the sub form also.
    Here is where the issue is, rather than tab through all the transaction items and already completed items in the sub form, I want the transaction form to open and set the focus on the sub form and the Brand field within the sub form to complete the process.

  6. #6
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Jump to mean last record of the subform

  7. #7
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Private Sub fsubOfficeSuppliesCatBre_Enter()
    DoCmd.GoToRecord , , acLast
    End Sub


    Private Sub Form_Current()
    Forms![frmTransactions]![fsubOfficeSuppliesCatBre].SetFocus
    End Sub

  8. #8
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142
    Yes got it working thank you so much

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

Similar Threads

  1. Set focus in other form?!!!
    By zareh in forum Forms
    Replies: 4
    Last Post: 02-27-2014, 02:33 AM
  2. Replies: 5
    Last Post: 02-20-2014, 11:05 AM
  3. Replies: 1
    Last Post: 02-29-2012, 09:38 AM
  4. Replies: 11
    Last Post: 01-26-2012, 01:22 PM
  5. Setting Focus on a Form
    By MFeightner in forum Forms
    Replies: 1
    Last Post: 07-30-2009, 07:49 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