Running Macro from Access
Running Macro from Access
(OP)
I have an access database. I have a query that I run w/a button on a form in access. How can I have access run a macro in VBA to input some of the data into Attachmate from the query I run. I've seen people do it w/a form, but not a table from a query which is what I have. Here is some of the code I have to put the data into Attachmate, but I'm lost when it comes to dealing w/the table
CODE
Sub Main
Dim Sessions, System As Object, Sess0 As Object
Set System = CreateObject("EXTRA.System")
Set Sessions = System.Sessions
Set Sess0 = System.ActiveSession
Do
Sub Main
Sess0.Screen.Moveto 5,73
Sess0.Screen.Sendkey
'this is where i dont know how get 'the account number from the query/table that was ran, 'and what to do after that.
Loop Until IsNull(Account Number)
End Sub
Dim Sessions, System As Object, Sess0 As Object
Set System = CreateObject("EXTRA.System")
Set Sessions = System.Sessions
Set Sess0 = System.ActiveSession
Do
Sub Main
Sess0.Screen.Moveto 5,73
Sess0.Screen.Sendkey
'this is where i dont know how get 'the account number from the query/table that was ran, 'and what to do after that.
Loop Until IsNull(Account Number)
End Sub
RE: Running Macro from Access
RE: Running Macro from Access
Hi,
Seems you might want a FUNCTION that returns a value given the account number on a psrticular row.
What are you trying to return from your session/screen?
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: Running Macro from Access
RE: Running Macro from Access
Since you're running this from MS Access, I'd suggest posting in forum705: Microsoft: Access Modules (VBA Coding).
I do ALL my Extra coding in Excel, since I always have data listed on a sheet for loading a screen. I'd do the query to your MS Access DB on an Excel sheet, loop thru the rows in the resultset to do what you apparently need to do -- which sounds like you're updating the mainframe with this account/code data.
If you want help doing this in Excel, post in forum707: VBA Visual Basic for Applications (Microsoft).
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: Running Macro from Access
RE: Running Macro from Access
Yes, you can loop thru the rows in a table. You must set a reference to the DAO recordset library and then declare objects for yoiur database and recordset. Open the recordset and loop thru each row.
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: Running Macro from Access
RE: Running Macro from Access
That's why I suggested you post in forum705: Microsoft: Access Modules (VBA Coding). I am not an Access VBA programmer. I can muddle thru, but I am not familiar with the Access Object Model or the DAO Object Model.
I am very familiar with the Excel Object Model and the ADO Object Model, which I use to grab data from Oracle, DB2, Access, Excel.
Skip,
Just traded in my old subtlety...
for a NUANCE!