We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

ACCESS and SQL 2000, problem with displaying data

hirak1977
hirak1977 asked
on
Medium Priority
501 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!!

Comment
Watch Question

Commented:
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

Author

Commented:
two DSN

Commented:
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

Author

Commented:
how do you create DSN less connection

Commented:
Take a look at think link.  I just walked someone through this a week ago.
https://www.experts-exchange.com/Databases/MS_Access/Q_20936165.html

Mike

Commented:
Let me know if you have any additional comments.

Thanks,
Mike

Author

Commented:
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.

Commented:
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

Author

Commented:
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!!!!

Commented:
where are you getting the error?  which line of code?

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

Author

Commented:
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.

Commented:
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

Author

Commented:
i am trying to use your own code for sql....

Commented:
The sub PingDatabase, wasn't in my code....I just doublechecked the link above and it's not there.

Mike

Author

Commented:
My bad! But I am stuck at the point of creating Macro... Need more details and small steps, if possible,.

Commented:
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

Commented:
make sure the name of the procedure you want to call is Public and not Private

Mike

Author

Commented:
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 .

Commented:
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

Author

Commented:
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.

Commented:
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

Author

Commented:
OH ! It's like a manual process. Can we automate it through code or somethign?

Commented:
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
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
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

Commented:
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
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.