123dstreet
Registered User.
- Local time
- Today, 01:26
- Joined
- Apr 14, 2010
- Messages
- 122
Hi all. I have an issue I don't even know where to start. In my sales order form, there is a combo box to select each Part, currently, if a specific part is selected (after update) then I have this code; what it does is goes to the LAST recorded Serial Number in the database.
Our current product will follow the same serial numbers, 3001, 3002, 3003... etc. our new product will start at 5000, 5001, 5002... etc. Now, my problem is when the current product is selected, how do I get it to refer back to the 3000's instead of going to the last record, which is 5000... any suggestions would be greatly appreciated. Also, the new product is almost the same as the current one, so it has to remain in the same table as the current.
Code:
BT_Serialize:
M = MsgBox("You are about to serialize " & Me![Qty] & " units of " & Me.Part_No & ". Do you want to proceed?", vbYesNo, "Serialization")
If M = vbNo Then GoTo ExitThis
If IsNull(Me![SNList]) = True Then
QMax = Me![Qty]
For Q = 1 To QMax
stDocName = "BTSN (Form)"
'stLinkCriteria = "[SOrderID] =" & Forms![S-Order (Form)].[Order ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
[COLOR=red] DoCmd.GoToRecord , , acLast[/COLOR]
N = Forms![BTSN (Form)]![BT100Serial]
[COLOR=red] DoCmd.GoToRecord , , acNewRec
[/COLOR] N = N + 1
stSNTextList = stSNTextList & " " & N
Forms![BTSN (Form)]![BT100Serial] = N
Forms![BTSN (Form)]![Part] = Me![Part No]
Forms![BTSN (Form)]![SOrderID] = Forms![S-Order (Form)].[Order ID]
'Forms![BTSN (Form)]![Cus Name] = DLookup("[Cus Name]", "Customer", "[Cus ID]=[Cus ID]")
'Add field to form here
Me![SNList] = stSNTextList
Refresh
Next Q
DoCmd.Close acForm, stDocName
GoTo ExitThis
Else
MsgBox ("You already generated Serial Numbers for this line item")
'Refresh
End If
Our current product will follow the same serial numbers, 3001, 3002, 3003... etc. our new product will start at 5000, 5001, 5002... etc. Now, my problem is when the current product is selected, how do I get it to refer back to the 3000's instead of going to the last record, which is 5000... any suggestions would be greatly appreciated. Also, the new product is almost the same as the current one, so it has to remain in the same table as the current.