Solved

ODBC System DSN & access 2007

Posted on 2008-10-14
8
1,485 Views
Last Modified: 2008-10-15
How can i get access to save the password when querying the odbc tables as it dosn't appear to do it in the system dsn setttings through the control panel
0
Comment
Question by:david_88
  • 5
  • 3
8 Comments
 
LVL 12

Expert Comment

by:rgn2121
ID: 22709864
I don't have 2007 in front of me, but 2003 MIGHT, might be the same...

Open your query in Design View and right click the top part of the window where it says something like query1: Select Query...

Go to properties and you can set your ODBC connection there and it will ask if you want to save the password...
0
 
LVL 12

Accepted Solution

by:
rgn2121 earned 500 total points
ID: 22709875
link to do it in 2007 for a pss-through-query...
http://support.microsoft.com/kb/303968
0
 

Author Comment

by:david_88
ID: 22709963
thats works great, however becuase i need to edit the sql based on paramenters and use that output as a record source is there a way to do this in vba code.  You have any links
0
 

Author Comment

by:david_88
ID: 22710214
how do you save it in a normal select query i put in the below is put into the connect str but the query does not work now

ODBC;DSN=mydsn;UID=sys;PWD=sys;DATABASE=ys;Network=DBMSSOCN;Address=43.132.178.42,1433
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 12

Expert Comment

by:rgn2121
ID: 22715856
I assume you are doing the select off of linked tables...if so, when you link them you have to check the "Save Password" checkbox....

However, if you are just looking to do the query, pull the data and use the recordset, then you can do all that with the pass through and in VBA...I can post examples later tonight when I get back to work.

Typically what I do is create my pass through and then create a make-table off of that so that I get my table.  You can edit the sql code at run time using VBA and make changes to the pass through and then call the make-table to create your table.

if you want to google it yourself you can, or you can wait till later tonight/early tomorrow morning and I can post an example.  
0
 
LVL 12

Expert Comment

by:rgn2121
ID: 22717899
Okay, this might not be the best solution, but it is what I use and it hasn't failed me yet... I am not sure what you are trying to do exactly, but hoepfully this well help you out.

Setup:
I am assuming for this example that you have a form with a Textbox and a button.  And lets say the user enters their last name to see how many orders they have that belongs to them.

You have one pass through query, assuming the data is stored on an external data source.  You also have a make table query that creates a table UserOrders from the pass through.  I will use tblUSers as the external datasource.

The code below should get you started with what you need to do.  If you have issues, Google is a great source for info and where I usually go first.
Keep in mid that if you are using a pass through you have to run a make-table off of that in order to get an actual table created and depending on the amount of data you pull you won't notice any real difference.  I generally pull around 10,000 records this way with no issues.






Code:
 

dim username as String

texbox1.setFocus

username=cstr(texbox1.text)
 
 

Dim db as Database

dim myMakeQuery as QueryDef

dim OriginalSql as string
 

'Sets your variable for the make table to your actual make table query

set MyMakeQuery = db.Querydefs("name of make table query")
 

'sets the variable to your original sql string with using the word customer as a filler for the username coming from the texbox

OriginalSql = "Select * From tblUsers Where tblUsers.User = customer"
 

'Gets what is in the original sql string after the word customer has been replaced with what was in the variable username.

db.querydefs("Name of your pass through query").SQL = Replace(originalSql, "customer", username)
 

MyMakeQuery.Execute    'Executes the make table query which creates your UserOrders table.
 

'Set your pass through query back to the original if necessary...

db.querydefs("Name of your pass through query").SQL = originalSql
 

MyMakeQuery.Close

Open in new window

0
 
LVL 12

Expert Comment

by:rgn2121
ID: 22717923
I forgot to mention, generally when you create Make-Table queries you get the pop-ups telling you that you are about to add so many rows to your table.  Since you probably don't want that, you will have to set the warnings to true or false.

DoCmd.SetWarnings False

Code....

DoCmd.SetWarnings True
0
 

Author Comment

by:david_88
ID: 22719395
thanks for the code i have a lot of queries that would need changing for this though......when you link them you have to check the "Save Password" checkbox.... where abouts is this im linking to an sql server table but no check box appears

thanks

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now