473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Link Refresh Code

I need to ask you some questions about the code below that you posted .I tried it and it is not working. can you, or anyone else that uses this code, reply to this- thanks!!!
Expand|Select|Wrap|Line Numbers
  1. On Error GoTo refresh_err 
  2.     Dim daoDB As DAO.Database 
  3.     Dim tdef As DAO.TableDef 
  4.     Dim strConnectOld As String 
  5.     Set daoDB = CurrentDb 
  6.     Set tdef = daoDB.TableDefs(strTablename) 
  7.     strConnectOld = tdef.Connect 
  8.     tdef.Connect = strConnectOld & "; UID=" & strUserName & "; PWD=" & strPassword 
  9.     tdef.RefreshLink 
  10.     tdef.Connect = strConnectOld 'restore no-password version of connect string 
  11.     fODBCTablesRefresh = True 
  12.     Exit Function 
  13. refresh_err: 
  14.     fODBCTablesRefresh = False 
  15. End Function
** Edit **
This thread was split from Run an AutoExec Macro where an ODBC password is required. There may be some relevant content there.
Sep 14 '09 #1

✓ answered by Stewart Ross

As the author of the function all I can say is that it is in use every day just as it was presented in the original thread. It is intended for auto-refresh of ODBC connections.

The function requires the ODBC connection username and password passed in as parameters (variables strUsername and strPassword). It also requires the name of one of the linked tables from that database (variable strTablename). If any one of these is missing or is incorrect either the connection will not be established or the table (and therefore the link as a whole) will not be refreshed.

Assuming it is an ODBC connection you are refreshing, the first thing to establish is are you passing the parameters correctly, bearing in mind that it is not the USER'S username and password but the CONNECTION's username and password which has to be passed to the function?

You will need to use the VB editor's debugging facilities to set breakpoints and test values. If this is something you have no knowledge of or cannot do then it is unlikely you will have sufficient understanding of what the function is doing to adapt it to your own needs.

-Stewart

4 3579
NeoPa
32,556 Expert Mod 16PB
Please refrain from posting your own requirements in someone else's thread. This is thread hijacking and is not allowed on this site.

Moving on, we can probably help you, but it's a good idea to include your questions when you post ;)

Hit us with the questions and we'll help where we can.
Sep 14 '09 #2
Stewart Ross
2,545 Expert Mod 2GB
As the author of the function all I can say is that it is in use every day just as it was presented in the original thread. It is intended for auto-refresh of ODBC connections.

The function requires the ODBC connection username and password passed in as parameters (variables strUsername and strPassword). It also requires the name of one of the linked tables from that database (variable strTablename). If any one of these is missing or is incorrect either the connection will not be established or the table (and therefore the link as a whole) will not be refreshed.

Assuming it is an ODBC connection you are refreshing, the first thing to establish is are you passing the parameters correctly, bearing in mind that it is not the USER'S username and password but the CONNECTION's username and password which has to be passed to the function?

You will need to use the VB editor's debugging facilities to set breakpoints and test values. If this is something you have no knowledge of or cannot do then it is unlikely you will have sufficient understanding of what the function is doing to adapt it to your own needs.

-Stewart
Sep 15 '09 #3
Sorry about the 'Hijacking' have never heard of this and will NOT do it in the future.

Took your advice and looked at the string again, the problem was that the constring used pwd and uid instead of 'password' and 'user'. Works fine now.

thanks!!!!
Sep 15 '09 #4
NeoPa
32,556 Expert Mod 16PB
Good to hear (both about the hijacking and certainly that you got the problem resolved).

Welcome to Bytes!
Sep 15 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: eric rudolph | last post by:
I am writing a photo gallery and suppose 8 photos are displayed. When the user clicks on a button under the picture, I want it to add that picture name to a "favorites" list within the session...
4
by: Melissa | last post by:
I have a frontend file named CustomerApp and backend file named CustomerData. CustomerApp is at C:\Customer Database and CustomerData is at S:\Customer Database. Could someone help me with the code...
0
by: Redstone | last post by:
When attempting to refresh a link through ODBC to a table (T_Leases) in my SQL backend, I get an error message teling me the Jet Engine can't find an object (A differnet table T_LockTypes in the...
7
by: Lisa | last post by:
I have an Access 2000 application that uses the following function to re-link my tables when I switch from my Current back end to a Dummy back end. I also use it to refresh my links. Function...
10
richardhodge
by: richardhodge | last post by:
I am a VB6 database programmer and have run into a small problem. The company I work for primarily uses Microsoft Access 2000 for the database that is the back end for our software. Well the...
7
by: ApexData | last post by:
Hello I currently Link the FE/BE using the LinkTables Option and the Linked Table Manager. Any time I need to move the BE to another location, I have to go through this process over again. I...
7
by: Revathi Balakrishnan | last post by:
Hi All If i use the below code i am able to disable the style sheet of a document. But i wanted to understand how this disabled property works internally? becaues in html normally if we do...
3
by: Roger | last post by:
I've got a sql server view, that I link as a table in access97 after initial linking, I can open the table and add more records (ie. the >* vcr button is enabled) the connect string for the...
4
by: squrel | last post by:
hello everyone.. i have a combobox and in its drop down i have 4 options (company,court,advocate,party).... the address of these options is saving in my database called address.... whenever i select...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.