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.