Hi all,
I wrote some code in Excel to open and run a module in Access. The code executes, but when I check the results I get no records, however if I just step back 1 line and rerun the query, I get records. Alternately, if I run the code twice it will get results the 2nd time.
The OpenCounter opens a Session in the terminal screen then performs a macro that writes to a temporary table.
Here is the code:
One thing I tried with limited success was to tell the OpenCounter to open and close the table after it was done writing to it, but that seems like a lazy solution and it also doesn't always work.
Any ideas? TIA
I wrote some code in Excel to open and run a module in Access. The code executes, but when I check the results I get no records, however if I just step back 1 line and rerun the query, I get records. Alternately, if I run the code twice it will get results the 2nd time.
The OpenCounter opens a Session in the terminal screen then performs a macro that writes to a temporary table.
Here is the code:
Code:
Dim db As ADODB.Connection, Rst As ADODB.Recordset
Dim Acc As Access.Application
Set db = New ADODB.Connection
db.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & DBPath
Set Rst = New ADODB.Recordset
Set Acc = GetObject(DBPath).Application
Acc.Run "OpenCounter", "ENROLL"
StrSQL = "SELECT tbl_Hold.* FROM tbl_HOLD"
Rst.Open Source:=StrSQL, ActiveConnection:=db, CursorType:=adOpenForwardOnly, LockType:=adLockOptimistic, Options:=adCmdText
Debug.Print Rst.EOF
If Not Rst.EOF Then...
One thing I tried with limited success was to tell the OpenCounter to open and close the table after it was done writing to it, but that seems like a lazy solution and it also doesn't always work.
Any ideas? TIA