going back to your first post
DoCmd.TransferDatabase acImport, "ODBC Database", _
"ODBC;DSN=DataSource1;UID=
User2;PWD=
www;LANGUAGE=us_english;" _
& "DATABASE=pubs", acTable, "Source Table Name", "ABC", False, True
you required the user to supply the bits in red.
so modify to
DoCmd.TransferDatabase acImport, "ODBC Database", _
"ODBC;DSN=DataSource1;UID=
" & User2 & ";PWD=
" & www & ";LANGUAGE=us_english;" _
& "DATABASE=pubs", acTable, "Source Table Name", "ABC", False, True
So now you need to capture values for user2 and www - so create an unbound form with controls called User2 and www, plus a button to run the import
as far as validation is concerned the code will fail with a wrong user or password so just include some error trapping code
Code:
On Error goto errctrl
DoCmd.TransferDatabase acImport, "ODBC Database", _
"ODBC;DSN=DataSource1;UID=" & User2 & ";PWD=" & www & ";LANGUAGE=us_english;" _
& "DATABASE=pubs", acTable, "Source Table Name", "ABC", False, True
exit sub
errctrl:
msgbox "Wrong username or password, please try again"