473,396 Members | 2,013 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,396 software developers and data experts.

{UNSOLVED} Access Project Issues

10
Hello All,

I have some questions about Access Projects. I recently converted an Access 2003 MDB to an ADP, because I was having difficulty linking the tables to SQL after moving it to different servers. I wanted an easier way to make the database portable. ie distribute the Front End to clients with different Back End servers.

I converted all the queries to SQL Views, and got the code to work. However there are still a few things that are not working as they should. I'll list them to make it clearer.

1. First off, how can I (is there a way to) distribute the ADE file to a client with a different SQL Server and Database Name, without displaying a Connection Error when they first open it? It looks for the old server. I know after they set the Connection, it works fine, but that error is annoying.

2. <FormName>.Recordset.Find doesn't seem to work anymore. When I try to Open a form and do a Find to place it on a Record, it doesn't work. Any idea why this is?

3. <FormName>.Recordset.AddNew acts weird. It doesn't add the record at the bottom, but instead, 2nd to last. Also, it doesn't fill in the default values as it should. Any idea's on this?

It seems there are bugs in the way Access forms deal with SQL tables in Projects. The funny thing is this all worked fine with the MDB, while Linking the tables to SQL using ODBC.

Any help would be much appreciated.
Nov 13 '06 #1
5 1455
MMcCarthy
14,534 Expert Mod 8TB
Just adding a post to move it back up the list.

I'm afraid ADP's are not my area of expertise. We do have some experts on the matter though.

Hello All,

I have some questions about Access Projects. I recently converted an Access 2003 MDB to an ADP, because I was having difficulty linking the tables to SQL after moving it to different servers. I wanted an easier way to make the database portable. ie distribute the Front End to clients with different Back End servers.

I converted all the queries to SQL Views, and got the code to work. However there are still a few things that are not working as they should. I'll list them to make it clearer.

1. First off, how can I (is there a way to) distribute the ADE file to a client with a different SQL Server and Database Name, without displaying a Connection Error when they first open it? It looks for the old server. I know after they set the Connection, it works fine, but that error is annoying.

2. <FormName>.Recordset.Find doesn't seem to work anymore. When I try to Open a form and do a Find to place it on a Record, it doesn't work. Any idea why this is?

3. <FormName>.Recordset.AddNew acts weird. It doesn't add the record at the bottom, but instead, 2nd to last. Also, it doesn't fill in the default values as it should. Any idea's on this?

It seems there are bugs in the way Access forms deal with SQL tables in Projects. The funny thing is this all worked fine with the MDB, while Linking the tables to SQL using ODBC.

Any help would be much appreciated.
Nov 14 '06 #2
NeoPa
32,556 Expert Mod 16PB
Not mine either I'm afraid - Sorry.
Nov 14 '06 #3
Nitro
10
I'm thinking about going back to the MDB. The ADP seems to have many issues. I haven't yet started the reports, so I need to decide before I do.

Maybe someone can help me with another problem. This is the reason I changed to the ADP to begin with.

I was having problems getting my DB to Link to different SQL servers. I got it to work fine on my own machine, but when I distributed it at the client, and to another office, the Link didn't work. It either timed out, or gave errors.

I created a LinkTables Method (below) that would allow me to distribute the DB to the client running on another server. I created a local Settings table to store the Connection Strings of different locations. I wanted to either use a DSN file, or connect completely through code. I didn't want to setup System/User ODBC connections on anybody's machine. Unfortunately, I wasn't the one testing it out, but for some reason the tech could not get connected to SQL, without setup up a System ODBC manually. That's the reason I changed to ADP, because it was easier to connect.

Anyway, here's my code, and Test Connection String. Anyone have comments why this would not work? Also, what is required in the Connection String?

Thanks.

Expand|Select|Wrap|Line Numbers
  1. Public Sub LinkTables(id)
  2. Dim DBPath As String
  3. Dim tds As TableDefs
  4. Dim td As TableDef
  5. Dim x, y, p As Integer
  6. Dim s, c As String
  7.  
  8.     On Error GoTo Error
  9.     DBPath = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\"))
  10.  
  11.     On Error Resume Next
  12.     If id = "" Then Exit Sub
  13.     c = DLookup("ConnStr", "Settings", "ID = '" & id & "'")
  14.     If c = "" Then Exit Sub
  15.     On Error GoTo Error
  16.  
  17. ' Test Connection
  18. c = "ODBC;DRIVER=SQL Server;UID=user;PWD=pass;SERVER=CORPMAT;DATABASE=AuditTest"    
  19.  
  20.     Set tds = CurrentDb.TableDefs
  21.     y = tds.Count
  22.     For x = 0 To y - 1
  23.         Set td = tds(x)
  24.         s = td.Connect
  25.         If Left(s, 4) = "ODBC" Then ' Check for SQL Link
  26. '        If Left(s, 9) = ";DATABASE" Then ' Check for MDB Link
  27.             td.Connect = c
  28.             td.RefreshLink
  29.         End If
  30.     Next
  31.     MsgBox "Tables Linked Successfully."
  32. leave:
  33.     Set tds = Nothing
  34.     Set td = Nothing
  35.     Exit Sub
  36. Error:
  37.     MsgBox "Error Linking Tables! " + Error$, vbCritical
  38.     Resume leave
  39. End Sub
  40.  
Nov 14 '06 #4
MMcCarthy
14,534 Expert Mod 8TB
To get proper attention to this issue I would start a new thread and copy and paste this question into it with a different title. It's more likely to be picked up by our experts.



I'm thinking about going back to the MDB. The ADP seems to have many issues. I haven't yet started the reports, so I need to decide before I do.

Maybe someone can help me with another problem. This is the reason I changed to the ADP to begin with.

I was having problems getting my DB to Link to different SQL servers. I got it to work fine on my own machine, but when I distributed it at the client, and to another office, the Link didn't work. It either timed out, or gave errors.

I created a LinkTables Method (below) that would allow me to distribute the DB to the client running on another server. I created a local Settings table to store the Connection Strings of different locations. I wanted to either use a DSN file, or connect completely through code. I didn't want to setup System/User ODBC connections on anybody's machine. Unfortunately, I wasn't the one testing it out, but for some reason the tech could not get connected to SQL, without setup up a System ODBC manually. That's the reason I changed to ADP, because it was easier to connect.

Anyway, here's my code, and Test Connection String. Anyone have comments why this would not work? Also, what is required in the Connection String?

Thanks.

Expand|Select|Wrap|Line Numbers
  1. Public Sub LinkTables(id)
  2. Dim DBPath As String
  3. Dim tds As TableDefs
  4. Dim td As TableDef
  5. Dim x, y, p As Integer
  6. Dim s, c As String
  7.  
  8.     On Error GoTo Error
  9.     DBPath = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\"))
  10.  
  11.     On Error Resume Next
  12.     If id = "" Then Exit Sub
  13.     c = DLookup("ConnStr", "Settings", "ID = '" & id & "'")
  14.     If c = "" Then Exit Sub
  15.     On Error GoTo Error
  16.  
  17. ' Test Connection
  18. c = "ODBC;DRIVER=SQL Server;UID=user;PWD=pass;SERVER=CORPMAT;DATABASE=AuditTest"    
  19.  
  20.     Set tds = CurrentDb.TableDefs
  21.     y = tds.Count
  22.     For x = 0 To y - 1
  23.         Set td = tds(x)
  24.         s = td.Connect
  25.         If Left(s, 4) = "ODBC" Then ' Check for SQL Link
  26. '        If Left(s, 9) = ";DATABASE" Then ' Check for MDB Link
  27.             td.Connect = c
  28.             td.RefreshLink
  29.         End If
  30.     Next
  31.     MsgBox "Tables Linked Successfully."
  32. leave:
  33.     Set tds = Nothing
  34.     Set td = Nothing
  35.     Exit Sub
  36. Error:
  37.     MsgBox "Error Linking Tables! " + Error$, vbCritical
  38.     Resume leave
  39. End Sub
  40.  
Nov 14 '06 #5
PEB
1,418 Expert 1GB
Once i've tried connection using ODBC to SQL Server... But i should create it manually in the ODBC settings....

When it was done there wasn't more problems with the connection...

But it was locally on my machine!

I'll try your code to see how it function on my machine... But this i'll do it next week on my work!
Nov 18 '06 #6

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

Similar topics

63
by: Jerome | last post by:
Hi, I'm a bit confused ... when would I rather write an database application using MS Access and Visual Basic and when (and why) would I rather write it using Visual Studio .Net? Is it as easy...
9
by: Mark | last post by:
I want to put out a Excel or Access database spreadsheet on a web page. Can I do this and will it let me update the spreadsheet or will it be a static web page? If not then should I put it out...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
2
by: Vadivel Kumar | last post by:
I have posted issues lot of times. Initially, some body will respond to that and once i replied there is no proper response after that. What is the way to let the people respond to my old,...
7
by: Simon Jefferies | last post by:
Hello, I'm trying to create a new ASP. NET Web Application project, when I enter a name and press OK i get the following: Web Access Failed. The default web access mode for this project is...
39
by: Marcin Zmyslowski | last post by:
Hello all! I have the following problem with MS Access 2003 permissions. I have two users. One is admin and the second one is user who has full permissions to enter modify and read data. I...
62
by: Ecohouse | last post by:
I was just wondering if there was any way to use a toolbar in Outlook 2002 in Access 2002? I want to create a custom toolbar in Access similar to the Calendar toolbar in Outlook. Any ideas?
34
by: Mathieu Trentesaux | last post by:
Hello I downloaded Office 2007 for this reason : It seems, once again, that it is impossible to save any modification done in a VBA library, from the main project in Access. The save button...
14
by: Monty | last post by:
Hello, I have created a solution which has both a web UI and a winform UI, the latter is just for administrators. The Web UI (a Web Application Project) and the winform project both...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.