Results 1 to 3 of 3
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839

    Combining Private Sub

    When I try to duplicate a record with the three following Private subs blank I run into a error code 2110 Access can't move the focus to the control. Is there a way to not get the error messages when duplicating the record? I still want to have the controls available to force the user to use the form in the correct sequence as described in the Standard Operating Procedures (SOP). My intent is to stop from filling in the field at the wrong time and to clear the field with the message box pops.

    Thanks

    Private Sub O6_RECOMMENDATION__VOTE_AfterUpdate()
    If Me.AO_RECOMMENDATION___VOTE & "" = "" Then
    MsgBox "AO Recommendation Vote must be filled in first"
    Me.O6_RECOMMENDATION__VOTE = Null
    AO_RECOMMENDATION___VOTE.SetFocus


    End If
    End Sub

    Private Sub GO_VOTE_AfterUpdate()
    If Me.O6_RECOMMENDATION__VOTE & "" = "" Then
    MsgBox "AO and O6 Recommendation Vote must be filled in first"
    Me.GO_Vote = Null
    O6_RECOMMENDATION__VOTE.SetFocus
    End If
    End Sub

    Private Sub Final_VOTE_AfterUpdate()
    If Me.AO_RECOMMENDATION___VOTE & "" = "" Or Me.AO_RECOMMENDATION___VOTE & "" = "" And Me!O6_Recommendation_Vote & "" = "" Then
    MsgBox "Select a combination of" & Chr(10) & Chr(10) & "AORB Level -" & Chr(9) & "AO Vote" & Chr(10) & "CCB Level -" & Chr(9) & "AO and O6 Votes" & Chr(10) & _
    "GO Level -" & Chr(9) & Chr(9) & "AO, O6 and GO Votes" & Chr(10) & Chr(10) & "before Final Vote is selected"
    Me.Final_Vote = Null
    O6_RECOMMENDATION__VOTE.SetFocus
    End If
    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    What do you mean by duplicating the record - duplicating how?

    What I do to control user order of input is to open form with controls disabled (except for at least 1). Controls are made available after input. Like:

    Private Sub AO_Recommendation_AfterUpdate()
    Me.O6_RECOMMENDATION__VOTE.Enabled = Not IsNull(Me.AO_Recommendation)
    End Sub

    This will work only if form is in Single View.

    However, if you want to allow edit of existing records on the same form, will probably want code in the current event to enable controls. Or do the reverse - form opens with all controls enabled and disable them if move to new record row.
    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
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    Thanks June7
    I used the following and it works like I want it to.

    Private Sub AOVote_BeforeUpdate(Cancel As Integer)
    Me.O6Vote.Enabled = Not IsNull(AOVote) And Me.Level <> "Level 1"
    Me.FinalVote.Enabled = Not IsNull(AOVote) And Me.Level = "Level 1" Or Me.Level = "Software" And Me.[Soft Level] = "Level 1"
    End Sub

    Private Sub O6Vote_BeforeUpdate(Cancel As Integer)
    Me.GOVote.Enabled = Not IsNull(O6Vote) And Me.Level = "Level 3 Cat 2"
    Me.GOVote.Enabled = Not IsNull(O6Vote) And Me.Level = "Level 3 Cat 2" Or Me.Level = "Software" And Me.[Soft Level] = "Level 3 Cat 2"
    Me.FinalVote.Enabled = Not IsNull(AOVote) And Not IsNull(O6Vote) And Me.Level <> "Level 1" Or Me.Level = "Software" And Me.[Soft Level] <> "Level 1"
    End Sub

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

Similar Threads

  1. Replies: 14
    Last Post: 07-22-2013, 12:39 PM
  2. Combining queries
    By jamo in forum Queries
    Replies: 11
    Last Post: 11-09-2012, 07:36 AM
  3. Combining two fields Help
    By Juan4412 in forum Queries
    Replies: 11
    Last Post: 09-30-2012, 05:40 PM
  4. Combining first and last name
    By JRINC in forum Forms
    Replies: 3
    Last Post: 09-27-2011, 01:18 PM
  5. Combining fields - iif??
    By annaisakiwi in forum Queries
    Replies: 10
    Last Post: 12-22-2010, 07:49 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