Popup Window

Having problem with a popup window to collect username and password for an ODBC DSN where the ODBC Manager does not supply login information (e.g. PostgreSQL). Here is the program logic:

[code] DSN = lbxSourceList.Cell( selrow, 0 )
App.MdlDB.DataSource = DSN

// now retrieve the login information from ODBC_Connection table
// added 8/23/13

if app.MdlDB.UserName = “” then
sql = "select DSN, UserName, Password, DefaultDB "
sql = sql + "from ODBC_Connection "
sql = sql + “where DSN = '” + App.MdlDB.DataSource + “’”

rs = App.MdlParamDB.SQLSelect( sql )
if rs = Nil then
  wndGetUserPW.Show  [b]// here is a little window to get login creds from user[/b] 
else
  rs.MoveFirst
  App.MdlDB.UserName = rs.IdxField(2).StringValue
  App.MdlDB.Password = rs.IdxField(3).StringValue
  App.MdlDB.DatabaseName = rs.IdxField(4).StringValue
end if

end if[/code]

Problem is that the little window doesn’t get focus and the app just moves to the next statement which tries to connect. Should I use a container control instead?

Does this work??

wndGetUserPW.ShowModal // here is a little window to get login creds from user