Results 1 to 5 of 5
  1. #1
    opopanax666 is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    27

    SOLVED: Error 3101 (but it shouldn't?..)

    Hi everybody,

    I use the code below to choose between 2 subs to execute:
    Code:
    Private Sub optgrpAEEA_AfterUpdate()
    
        Select Case optgrpRET.Value
            Case 1
                PPRODUCT = 93
            Case 2
                PPRODUCT = 94
            Case 3
                PPRODUCT = 95
            Case 4
                PPRODUCT = 96
        End Select
            
        If PPRODUCT = 96 Then
            Call Wegschrijven
        Else
            Call Wegschrijven_bis
        End If
        
    End Sub
    ------------------------------------------------------------
    Private Sub Wegschrijven()
    
        Me![Product_id] = PPRODUCT
        Me![Bestemming_id] = PBESTEMMING
        Me![Gewicht_bruto] = PBRUTO
        Me![Gewicht_tarra] = PTARRA
        Me![Gewicht_netto] = PNETTO
        ACODE = Format(Me.Geprod_ID.Value, "000-000")
        
        Me.Dirty = False
        
        Me.btnDirectNetto.SetFocus
    
        Me.mpgNetto.Pages(0).Visible = False
        Me.mpgNetto.Pages(1).Visible = False
        Me.mpgNetto.Pages(2).Visible = False
        Me.mpgNetto.Pages(3).Visible = False
        Me.mpgNetto.Pages(4).Visible = False
        Me.mpgNetto.Pages(5).Visible = False
        Me.mpgNetto.Pages(6).Visible = False
        Me.mpgNetto.Pages(7).Visible = False
        Me.mpgNetto.Pages(8).Visible = False
        Me.mpgNetto.Pages(9).Visible = False
        Me.mpgNetto.Pages(10).Visible = False
        Me.mpgNetto.Pages(11).Visible = False
        Me.mpgNetto.Pages(12).Visible = True
        
        Me.txtAcode.BackColor = RGB(167, 218, 78)
        Me.txtBestemming.Value = Me![Bestemming_naam]
        Me.txtProduct.Value = Me![Product_naam]
        Me.txtAcode.Value = ACODE
        
    End Sub
    ----------------------------------------------------------------
    Private Sub Wegschrijven_bis()
    
        Me![Product_id] = PPRODUCT
        Me![Bestemming_id] = PBESTEMMING
        Me![Gewicht_bruto] = PBRUTO
        Me![Gewicht_tarra] = PTARRA
        Me![Gewicht_netto] = PNETTO
        
        Me.Dirty = False
        
        Me.btnDirectNetto.SetFocus
    
        Me.mpgNetto.Pages(0).Visible = False
        Me.mpgNetto.Pages(1).Visible = False
        Me.mpgNetto.Pages(2).Visible = False
        Me.mpgNetto.Pages(3).Visible = False
        Me.mpgNetto.Pages(4).Visible = False
        Me.mpgNetto.Pages(5).Visible = False
        Me.mpgNetto.Pages(6).Visible = False
        Me.mpgNetto.Pages(7).Visible = False
        Me.mpgNetto.Pages(8).Visible = False
        Me.mpgNetto.Pages(9).Visible = False
        Me.mpgNetto.Pages(10).Visible = False
        Me.mpgNetto.Pages(11).Visible = False
        Me.mpgNetto.Pages(12).Visible = True
        
        Me.txtBestemming.Value = Me![Bestemming_naam]
        Me.txtProduct.Value = Me![Product_naam]
        Me.txtAcode.BackColor = RGB(255, 255, 255)
        Me.txtAcode.SetFocus
    
        
    End Sub
    For the cases where the program has to execute the first sub (Wegschrijven), everything works perfectly, so putting the value of PPRODUCT in [Product_id] creates a new record, and all the other values are written.
    But what has me stumped is the fact that when he has to execute the second sub (Wegschrijven_bis), the program gives a 3101 error (can't find any Product_id in table), although the second sub is only a slight variation on the first...


    I have Option Explicit "enabled", all variables are declared, and no controls on the form have a name similar to any of the field names, so what gives?

    Can anybody spot the problem?
    Thanks for any feedback.
    Last edited by opopanax666; 12-09-2010 at 03:25 AM. Reason: solved

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try a /decompile.

  3. #3
    opopanax666 is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    27
    Quote Originally Posted by RuralGuy View Post
    Try a /decompile.
    Nope, did a decompile and a compress & repair, but no go.
    I just don't understand why it doesn't work. It should, right?

  4. #4
    opopanax666 is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    27
    Quote Originally Posted by opopanax666 View Post
    Code:
    Private Sub optgrpAEEA_AfterUpdate()
    
        Select Case optgrpRET.Value
            Case 1
                PPRODUCT = 93...
    Never mind, I copied the code from another option group, and forgot to rename the "Select Case", so PPRODUCT was always 0...

    So, this one's solved

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That's great. At least you were not going crazy and neither was Access!

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

Similar Threads

  1. Replies: 2
    Last Post: 12-02-2010, 02:35 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