MCTampa
Board Regular
- Joined
- Apr 14, 2016
- Messages
- 97
Ok, this shouldbe the last thing I need help on.
Thanks to those who helped thus far, my project is pretty much done.
Here is my issue:
I have a form where users can enter multiple resorts and dates for which theywant to perform an action.
The form locks the values in a table called Log.
My database assigns an auto number to each entry which is fine for me as Iarchive them after they are run.
The first part of my code is as follows:
Code:
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
With rst[/FONT][/COLOR][COLOR=#222222][FONT=Verdana]rst.Open"selectResort_Code,AS400SD,End_Date,Unit_Size,Flag,Return,Track_Code,Res_Line from Log", CurrentProject.Connection, adOpenStatic, adLockOptimistic
[/FONT][/COLOR]
This selects the variables to send to AS400.
However, it only works for the first entry in the table.
I want the user to be able to enter multiple scenarios and, by adding two moreform fields called First Entry and Last Entry, allow the user to run Entry 1 to1 or 1 to 5.
I want the script to understand to repeat the loop for each entry that satisfies the criteria.
I was thinking of something like this (which is just a snippet of my code, the rest works).
Code:
[COLOR=#222222][FONT=Verdana]If.Fields("Entry") >= Screen.ActiveForm!FirstEntry And.Fields("Entry") <= Screen.ActiveForm!LastEntry Then[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]CallsendToNa("PUT", "400", 21, 18, 0, 0) 'Go to Option 400[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]CallsendToNa("COM", "enter", 0, 0, 0, 0)[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]CallsendToNa("PUT", .Fields("Resort_Code"), 6, 43, 0, 0) 'PassResort ID[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]CallsendToNa("PUT", .Fields("AS400SD"), 8, 43, 0, 0) 'PassStart Date[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]If.Fields("Track_Code") = "ALL" Then CallsendToNa("PUT", "*", 10, 43, 0, 0): Call sendToNa("COM","enter", 0, 0, 0, 0) _[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]Else: CallsendToNa("COM", "PF4", 0, 0, 0, 0) 'Prompt for Track Codeselection[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]If.Fields("Track_Code") = "A" Then CallsendToNa("PUT", "X", 14, 37, 0, 0): CallsendToNa("COM", "enter", 0, 0, 0, 0) _[/FONT][/COLOR]
But I’m not sure how to work the Loop portion into it.
Last edited: