The code below is all in one script called by the main screen. I have 2 buttons. Move record forward and move Record Previous. What i need to do is call a script "MoveForward" with the move forward button and call another script "Move Previous" with the move previos button. But how to I pass my record set object "rst"? see code below! The issue I am having is I am stuck in a do until loop therefore it is not allowing me to click any objects on my screen. i.e move forward and move previos buttons. That's why if maybe I can call 2 different scrips up with passing the recordset it may be easier.
Dim conn,rst
Dim SQL_Table
Set conn = CreateObject("ADODB.Connection")
Set rst = CreateObject("ADODB.Recordset")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=c:\G&S.mdb"
rst.CursorLocation = 3
rst.CursorType = 3
rst.LockType = 3
SQL_Table = "Select * FROM tblData1"
rst.open SQL_Table,conn
Do Until strscreen <> HmiRuntime.BaseScreenName
SmartTags("LASER_2D") = rst.Fields(0).Value
SmartTags("LASER_2D_GRADE") = rst.Fields(1).Value
SmartTags("G&S_2D") = rst.Fields(2).Value
Do While SmartTags("btnNext")=True Or SmartTags("btnPrev")=True
If SmartTags("btnNext")=True Then
rst.MoveNext
SmartTags("btnNext")=False
If SmartTags("btnPrev")=True Then
rst.MovePrevious
SmartTags("btnPrev")=False
End If
End If
ActivateScreen "Screen_1",0
Loop
Loop
Set rst = Nothing
Set conn = Nothing
Dim conn,rst
Dim SQL_Table
Set conn = CreateObject("ADODB.Connection")
Set rst = CreateObject("ADODB.Recordset")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=c:\G&S.mdb"
rst.CursorLocation = 3
rst.CursorType = 3
rst.LockType = 3
SQL_Table = "Select * FROM tblData1"
rst.open SQL_Table,conn
Do Until strscreen <> HmiRuntime.BaseScreenName
SmartTags("LASER_2D") = rst.Fields(0).Value
SmartTags("LASER_2D_GRADE") = rst.Fields(1).Value
SmartTags("G&S_2D") = rst.Fields(2).Value
Do While SmartTags("btnNext")=True Or SmartTags("btnPrev")=True
If SmartTags("btnNext")=True Then
rst.MoveNext
SmartTags("btnNext")=False
If SmartTags("btnPrev")=True Then
rst.MovePrevious
SmartTags("btnPrev")=False
End If
End If
ActivateScreen "Screen_1",0
Loop
Loop
Set rst = Nothing
Set conn = Nothing
Last edited: