×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Running Macro from Access

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

 

RE: Running Macro from Access

(OP)
Anyone know if this is possible?

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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Running Macro from Access

(OP)
I'm not wanting to return anything from the screen. What I'm wanting to do is take the account number and there is another row called Code, and put them into the screen, first I would need to put the account number in, hit enter, then put the code in and hit enter again and repeat until it's gone thru them all.

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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Running Macro from Access

(OP)
Correct I'm updating mainframe w/the Code field after I put in the account. I've seen it ran directly from a form in access but wasn't sure if it can be done directly from a table.

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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Running Macro from Access

(OP)
Can you post an example of that. Not sure I quite udnerstand

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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close