View Full Version : ADD and EDIT Access 03 front end SQLS Express 05 back end


Lightwave
01-05-2011, 06:45 AM
OK - I've done quite a lot with access 03 and I am now making my first tentative stesp to upsizing to SQL.

As a starter I loaded SQL Express on my machine and I can link through DSN ODBC to get the tables in

Great - I pull them in and I can design forms based on this.

I am aware that SQLServer handles primary keys completely differently so I don't have primary keys on any of the tables that I've created.

Several points
I've created a couple of really simple tables in some dummy databases through sql just to have some test data
There is no primary key set on the tables
I also can't ADD or EDIT any of the records in the Access 2003 front end.

OK I'm guessing this is a rookie error..

Why can't I ADD or EDIT records in the front end and what do I need to invoke to do this?? I did a search but nothing seemed to be quite what I was looking for. I've got books as well but they don't seem to be specific enough.

Could someone point me to a link or a good book that will give me a head start?

pbaldy
01-05-2011, 08:13 AM
I think you've got it reversed. The SS tables must have primary keys to be able to add/edit from Access.

Lightwave
01-05-2011, 10:07 AM
Right got it ....

I'm really starting from zero but this site seems to have quite a lot of useful syntax which I hope to do something with.

http://www.w3schools.com/sql/default.asp

and this along with pbaldy's response should be the solution

http://www.w3schools.com/sql/sql_primarykey.asp

It would appear my life in the land of pretty GUIs maybe coming to an end.

pbaldy
01-05-2011, 10:30 AM
You can use the GUI in Management Studio do add keys. It operates pretty much the same as in Access: get table in design view, highlight the field, hit the Key icon, save the table.

Lightwave
01-05-2011, 11:55 AM
Superb

I've just pulled across a table and I am able to edit it. Can't seem to add but I kind of think I know why.

One question.

Is it bad practice to create the queries in the front end in Access?
(I see it lets you do that)
Should you really create the queries in the backend with SQL somehow and then link to them in some shape or fashion?

pbaldy
01-05-2011, 12:06 PM
You'll probably get varying opinions on that. I tend to have the majority of queries in Access, and switch to views and stored procedures when performance is an issue. It's easier to use parameters in an Access query. It's not hard to use them in a pass-through query or stored procedure, but it's a little more work. Access is actually pretty good at letting SQL Server do the work, so most regular Access queries will perform fine.

Lightwave
01-05-2011, 01:44 PM
Thanks much appreciated.