Solved

ACCESS and SQL 2000, problem with displaying data

Posted on 2004-04-06
26
413 Views
Last Modified: 2009-07-29
I have really weird problem that is driving me crazy. I had access backend and front end. I moved backend to SQL 2000 and kept the front end intact in Access. Now, It's seemed to be running fine. But every now and then, it does not populate the particular order( Order entry system),instead it would just display "#ERROR?" and "#Name?".  The strange thing is, if I goto SQl backend to look for the specific order, it wud display it correctly. I have also noticed that the SQL linked tables in access would display "#NAME?" , if i try to open the tables in access itself rather than going into backend  - SQL.

I am really lost here.


HELP!!

0
Comment
Question by:hirak1977
  • 15
  • 11
26 Comments
 
LVL 18

Expert Comment

by:Data-Man
ID: 10765977
What method are you using to connect your tables to the frontend?

DSN, DSN-Less

If it only happens periodically, it sounds like Access is losing it's connection to SQL server.

Mike
0
 
LVL 1

Author Comment

by:hirak1977
ID: 10766104
two DSN
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10766205
I have an Access 2002 Frontend with a SQL Server 2000 backend.  I use a DSN-Less connection.  Makes life a who lot easier.  I'm not sure if your problem is a DSN related problem or a timing issue.  

Are you making table changes in SQL Server?  Maybe Access doesn't know what to do when the structure changes.

Mike
0
 
LVL 1

Author Comment

by:hirak1977
ID: 10766293
how do you create DSN less connection
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10766387
Take a look at think link.  I just walked someone through this a week ago.
http://www.experts-exchange.com/Databases/MS_Access/Q_20936165.html

Mike
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10766553
Let me know if you have any additional comments.

Thanks,
Mike
0
 
LVL 1

Author Comment

by:hirak1977
ID: 10775585
yeah  man, I have copied your code into module to make it DSNless. But I am confused with the Macro step and after that.
could you plz explain.
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10775624
The code needs to run when the application starts.  You can call the code via the run command action of a macro.  Or if you have a splash screen you can call the code from there.

does that help?

Mike
0
 
LVL 1

Author Comment

by:hirak1977
ID: 10775669
NO ! :(((
It's also giving me an error on "Opendatabase()" method or Pingdatabase function.

My original problem is almost solved.  Now i just need to be able to make it DSN less. If I can somehow import some tables and stored them in Access FE as local tables. It would be great and I just want to link rest of the tables.

HELP!!!!

0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10776101
where are you getting the error?  which line of code?

You can run append queries to add records to local frontend tables.
0
 
LVL 1

Author Comment

by:hirak1977
ID: 10776129
Public Sub PingDatabase()   ' Ping the back end so that the application caches the connect string and won't ask again.

    Set db = OpenDatabase("", False, True, GetConnectString)
    DoCmd.Beep  ' Ping!
   
End Sub


I am gettign error on opendatabase() ,, it's saying fucntion or sub not found.
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10776262
Are you trying to open the Access or SQL Server database?  I'm not sure why you need the Opendatabase here.  since the back end is SQL Server, there is nothing to open.

could you store the connection string in a constant and not use the opendatabase?

Mike
0
 
LVL 1

Author Comment

by:hirak1977
ID: 10776285
i am trying to use your own code for sql....
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 18

Expert Comment

by:Data-Man
ID: 10776312
The sub PingDatabase, wasn't in my code....I just doublechecked the link above and it's not there.

Mike
0
 
LVL 1

Author Comment

by:hirak1977
ID: 10776772
My bad! But I am stuck at the point of creating Macro... Need more details and small steps, if possible,.
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10776792
Create a new macro
Action is 'RunCode'
Action Argument is the name of the procedure you want to execute.  =name of proc ()

Save it with the name AutoExec

With that name it will execute when the database opens.

Thanks,
Mike
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10776801
make sure the name of the procedure you want to call is Public and not Private

Mike
0
 
LVL 1

Author Comment

by:hirak1977
ID: 10777187
Hey MIke!
Thanks for your help. Now the problem is I have two separate SQL database. I wanted to linked one of them , which is done successfully with your help. But how do I import tables from second SQL database to access.  The reason behind importing tables and storing them in the local tables is because I have got  one form in my system which is based upon many complex queries. I hope keeping some tables at FE will reduce the network traffic and speed up the forms.

Let me know ur views.

Thanks!
 I will increase the points to max .

0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10777310
If the queries are complex then I would opt for stored procedures.  The data is already in SQL Server, the power of stored procs will blow Access out of the water any day of the week.  Even returning a fairly large amount of data, it is faster to process in SQL Server and retrieve the data using ADO Recordsets.  

If this all sounds foriegn to you, you can do this instead.

Change the connection string to be the other database
Create front end tables that match your SQL Server tables
Using append queries copy the records from the SQL Server tables to your newly created Access tables
change the connection string to the other database to revert it bakc to the first database.

How would you keep the local tables current?

Mike
0
 
LVL 1

Author Comment

by:hirak1977
ID: 10777487
WELL, the only reason behind still sticking to access query is because converting them into stored procedure is a tedious and time consuming jobs. PPl. are suggesting that copying and pasting in SQL will work. But all of my queries are based upon forms->textbox or forms->combo. I have no idea how to include them in the store procedure. And I also dont know how to call them from access. I am sure, it's very logn process.
 Neway,
I will pay attention to your other solutions. But second step seems foreign to me. You meant linking them first and then using append query to copy records, If yes, how? can you give me an example.

Ideally, i would like to write a procedure to update local tables from my second database...



Change the connection string to be the other database
Create front end tables that match your SQL Server tables
Using append queries copy the records from the SQL Server tables to your newly created Access tables ------ HOW?
change the connection string to the other database to revert it bakc to the first database.
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10777631
In the QBE Grid, add 1 SQL Server table

Change the query type to an append query (query menu item)   The table name should be the same as the SQL server name except that you might put FE at the end.  Table names must be unique.

Drag all the fields from the SQL Server table to the grid.  If you have the same field names, it should automatically populate the append to field name.

Run the query....if you want to save it for later you can, give it a useful name like, qappSQLSeverTableName2FE

repeat the process until all the data is in your FE tables.

Mike

0
 
LVL 1

Author Comment

by:hirak1977
ID: 10777650
OH ! It's like a manual process. Can we automate it through code or somethign?
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10777855
It could be....depends on how much data you are talking about.......but we are into a whole other area now.

Why not close this one out, and post your new question...you might get some ideas from other people in the same boat.

Regards,
Mike
0
 
LVL 18

Accepted Solution

by:
Data-Man earned 500 total points
ID: 10778196
One other comment.  If ALLyour data is in SQL Server, you may look at creating an Access ADP.  Read up on it...very powerful.

Regards,
Mike
0
 
LVL 1

Author Comment

by:hirak1977
ID: 10778299
Excellent! Thanks a lot for your help. I wanna learn converting access query to sql store procedure. If you have it handly pla. paste the samples.

once again , i appreciate your help. I might paste one or more questions.


Thanks!
Hirak
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 10778333
if you take your access database and use the upsize wizard Tools | Database Utilities | Upsizing wizard.  Choose ADP at the end...it will attemp to convert your queries to view, stored procs and user-defined functions AUTOMATICALLY....very powerful....not foolproof.  But it will get you started.

Mike
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

760 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

21 Experts available now in Live!

Get 1:1 Help Now