iSeries Automatic Login

Local time
Today, 01:46
Joined
Feb 25, 2008
Messages
410
Hello,

I have an interesting solution to a problem I've had for a looong time now.

I have reports in an Access database that I have to run manually every day because the data source of the reports is a DSN connection to an iSeries server. I have to run these manually because no matter what connection string or settings you use in the driver, it would ALWAYS prompt you for your credentials. See attachment.

Now, I know you die-hard Access folks might lynch me, but I have found SendKeys to be my only option. It's interesting, though, the only way I could get it to work is this:

Task Scheduler opens the mdb file.
The AutoExec macro opens the hidden form "USysPersist"
The OnCurrent event of USysPersist uses SendKeys to send my credentials to the active window.
Imediately after the SendKeys, the Source Object of subform on USysPersist is set to a form called "USysPersistODBC"
The RecordSource of USysPersistODBC is a table that has previously been linked to the server.
Now, since the mdb is opening a connection to the server, it prompts for credentials.
Since the SendKeys and the opening of the connection happen so fast, the keys sent end up in the login prompt.

This is the only way I could get this to work, and I don't understand why.
You would think you need to open the connection first to get the login prompt, then supply the sendkeys, but it doesn't work that way!
 

Attachments

  • iSeriesLogin.JPG
    iSeriesLogin.JPG
    12 KB · Views: 287

Users who are viewing this thread

Back
Top Bottom