Link to home
Start Free TrialLog in
Avatar of deer777
deer777Flag for United States of America

asked on

MS Access SQL Server Table Connection

I need to connect to a SQL Server table from MS Access.  The table name in Access is 123 but the SQL Server table name is 123_v_username.  I need the table name (123) to stay the same in Access but only change the connection string from SQL Server to change to 123_v_username.  How would I write the code to do this.
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

You can do like below

Pass the name of the table at runtime

Exec('' select columnname from ' + variabletablename + '')
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial