Results 1 to 6 of 6
  1. #1
    CNW is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    5

    Setfocus from split form to main form


    I have a form set to split form view. The split form has two fields displayed. The main form has all fields displayed. I have a VBA routine defined so that when I change contents of the combo box title field it requeries the form and setfocus to a field displayed on the main form. All works fine if I am on the main form as all fields are showing. However, if I do the same on the split form view it errors out as the field into which I want to set focus is not displayed on the split form view. I want this to work either way as I will not be the only user. I have tried Forms!f_Techniques.SetFocus followed by Forms!f_Techniques.form.narrative.setfocus but can not get the focus back to the main form from within VBA. Is there specific syntax to reference the main form verses the split form? Thank you in advance for any assistance offered.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    How do you not display fields in the datasheet part of split form while they are displayed in the single part? With right click Hide/Unhide?

    I think you might have run up against a deficiency of split form. I can't find any way to address the single or datasheet parts of the split form. Only thing I found was this thread showing use of SendKeys to cycle through parts of db and form http://www.utteraccess.com/forum/Set...-t1974783.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
    Missinglinq's Avatar
    Missinglinq is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Not sure I'd call this a 'deficiency' of split form! The primary purpose of this new (in 2007/2010) feature is to allow you to use the Datasheet portion of the Form to quickly locate a Record, and then use the Form portion to easily View or Edit the Record. Previously, to have this kind of functionality, and it is something developers/users frequently wanted, you'd have to

    1. Display all Records in a Datasheet View Form
    2. Grab the Primary Field of the Current Record
    3. Write code to open a second, Single View Form, to the Record that matches the PK
    4. Do whatever to the selected Record
    5. Close the secondary Form
    6. Return to the Datasheet View Form

    Now, all you have to do for this functionality, is to set the Default View Property of the Form to Split Form. If used for the purpose that it was developed for, it's not deficient at all!

    If you want to prevent the error, i.e. keep users from utilizing the Combobox while on the Datasheet portion of the Form, the only thing I can think of is to set the Split Form Datasheet Property from Allow Edits to Read Only.

    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
    CNW is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    5
    Thank you June7 and Missingling for your replies. It appears that the best solution might be to set splitform portion to read only forcing edits on main form as you suggest Missingling. I looked at any other way I could programmatically accomplish a shift back to main form but never came up with an option. If I do will edit this post. Thank you again!

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Yes, I can see 'deficiency' was wrong choice of word. Trying to use a tool as it wasn't intended will lead to frustrations. I like to set up forms so can be navigated without mousing and just haven't found use for the split form.
    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
    CNW is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    5
    I have found a workable solution to issue. This form is based on multiple tabs. By putting an OnClick event in each field of the splitform I can fire code to shift focus back to main form. See following code for details.
    '---------------------------------------------------------------------------------------
    ' Procedure : LName_Click
    ' Author : CNW
    ' Date : 06/18/2013
    ' Purpose : Used for subdatasheet to focus back to main form.
    '---------------------------------------------------------------------------------------
    '
    Private Sub LName_Click()
    If Nz(Me.ubLogin) = "" Then
    MsgBox "Entry is required!", vbCritical
    Application.Echo False
    Forms.f_Cont.Form.Purchased.SetFocus
    Forms.f_Cont.SetFocus
    Forms.f_Cont.ubLogin.SetFocus
    Application.Echo True
    End If
    End Sub
    Missingling and June7 I hope you are doing well.

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

Similar Threads

  1. Replies: 2
    Last Post: 11-13-2012, 02:11 PM
  2. Replies: 3
    Last Post: 05-02-2012, 10:13 AM
  3. Replies: 1
    Last Post: 12-12-2011, 01:58 PM
  4. Replies: 1
    Last Post: 11-21-2011, 07:58 AM
  5. Setfocus Split Form Issues
    By cksm4 in forum Programming
    Replies: 6
    Last Post: 10-13-2010, 02:46 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