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!

Visual Basic/As400

Status
Not open for further replies.

ferreiramarques

Programmer
Feb 28, 2003
8
PT
I'm using the following code to connect to an AS400. Everything works fine except when I need to login with a different userID. How can I force a signon when userID is different ?



Function test(database)
Set as400 = Nothing
as400.Define UCase(as400systems.DefaultSystem)
Set pgm.system = as400
If database <> &quot;XXX&quot; Then
pgm.system.UserID = UserName & &quot;Y&quot;
Else
pgm.system.UserID = UserName
End If
as400.Signon

End Function
 
What happens when you do this? Do you get an error message or does it just do nothing? If you Set as400 = Nothing again does it lose the conection to the AS400?
 
My intention is close the conection, because this function only runs if the user try to connect to a different database.

Set as400=nothing, was a try to make the signon to open again, asking for a new user and password.
 
Define your username as

dim username as string * 10

username = string(10,&quot; &quot;)

the above statement will fill all 10 character with valid spaces.

if you do not do that, and your username is less that 10 character long, visual basic fills the rest of the length with carbage.

be careful with the ' username & &quot;Y&quot; ' statement as this will add the &quot;Y&quot; in the 11th character.

have fun
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top