andrewf10
Registered User.
- Local time
- Today, 20:15
- Joined
- Mar 2, 2003
- Messages
- 114
Apologies for asking this question but I'm working on my first ever module here.
I've got a large chunk of code that I've copied and pasted onto 16 other forms. Obviously it would be much neater to have it once in a module but I'm having problems. Here's a sample of where I'm at.
******************************
Public Function BOMCODE()
Dim BARCODELINE4 As String
Dim NORMALPACKQTY As String
If (BARCODELINE4 = "Contents 1" And NORMALPACKQTY = "0") Then
QUANTITY_1 = "0.004"
QUANTITY_2 = "1"
QUANTITY_4 = "1"
ElseIf (BARCODELINE4 = "Contents 1" And NORMALPACKQTY = "2") Then
QUANTITY_1 = "0.004"
QUANTITY_2 = "1"
QUANTITY_4 = "2"
End If
End Function
******************************
Now here's the code on 1 of those forms
******************************
Private Sub BARCODELINE4_AfterUpdate()
Call Module1.BOMCODE
End Sub
The afterupdate is calling the module OK but when I step through the code, the module thinks that the BARCODELINE4 and NORMALPACKQTY fields have "" in them.
Am I totally off the beaten track?
Many thanks in advance (again!!)
I've got a large chunk of code that I've copied and pasted onto 16 other forms. Obviously it would be much neater to have it once in a module but I'm having problems. Here's a sample of where I'm at.
******************************
Public Function BOMCODE()
Dim BARCODELINE4 As String
Dim NORMALPACKQTY As String
If (BARCODELINE4 = "Contents 1" And NORMALPACKQTY = "0") Then
QUANTITY_1 = "0.004"
QUANTITY_2 = "1"
QUANTITY_4 = "1"
ElseIf (BARCODELINE4 = "Contents 1" And NORMALPACKQTY = "2") Then
QUANTITY_1 = "0.004"
QUANTITY_2 = "1"
QUANTITY_4 = "2"
End If
End Function
******************************
Now here's the code on 1 of those forms
******************************
Private Sub BARCODELINE4_AfterUpdate()
Call Module1.BOMCODE
End Sub
The afterupdate is calling the module OK but when I step through the code, the module thinks that the BARCODELINE4 and NORMALPACKQTY fields have "" in them.
Am I totally off the beaten track?
Many thanks in advance (again!!)