Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Access and Attachmate 1

Status
Not open for further replies.

Inovate

Technical User
Oct 24, 2006
15
US
I have wrote many VBA scripts to pull information from Attachmate to Microsoft Excel, but I have never wrote a script in Access. Here is the question:

I have a Table the contains three fields (Date, Associate Number, Money Collected) the data is contained in Attachmate and I need to scrape the screen and put in the Microsoft Table. In Excel this is a simplistic operation but not sure how to accomplish this in Access.

Second question is if I have data in a table in Access how do I access that data to send to the attachmate screen to get additional data to insert in the column to the right. Once again in Excel this is easy.

Any help you can yield would be well appreciative.

Thanks,

Inovate
 
I'm assuming you know how to obtain your screen object.

Code:
Sub PopulateTable
    Dim oDB As Database
    Dim oRS As Recordset
    Dim sTable
    
    Set oDB = OpenDatabase(sDB)
    Set oRS = oDB.OpenRecordset("tblMyTable")
'To seach and add and edit
    With oRS
        .Index = "Date"
        .Seek "=","01/01/2007"
        If .NoMatch Then
            .AddNew
            .Fields("Date") = Screen.GetString(1,1,10)
            .Fields("Associate") = Screen.GetString(2,1,10)
            .Fields("Money") = Screen.GetString(3,1,10)
        Else
            .Edit
            .Fields("Date") = Screen.GetString(1,1,10)
            .Fields("Associate") = Screen.GetString(2,1,10)
            .Fields("Money") = Screen.GetString(3,1,10)
        End If
        .Update
    End With
'To enumerate
    With oRS
    While Not .EOF
        Screen.PutString .Fields("Date"),1,1
        Screen.PutString .Fields("Associate"),2,1
        Screen.PutString .Fields("Money"),3,1
        .MoveNext
    Wend
    oRS.Close
End Sub
 
Thank you Skie, I will try the script. How would I loop it?

Say I have 100 associate numbers stored in the Access table and I want to send each associate # to attachmate to pull the associate name and hire date and fill the access table with the data, what would the loop look like. In excel to move down the table I use inc=inc+1 to move down the rows.
 
Skie, I was able to figure it out, you actually had it in your script I just didn't understand the steps at first....This is great, thank you for your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top