Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to ADP and SQL 1

Status
Not open for further replies.

edhead

IS-IT--Management
May 1, 2002
101
US
I am trying to learn ADPs and SQL, and have run into a problem.
I created a DB in SQL Server '05 with 2 tables. Then created an ADP in Access '03 using the "Project using existing database" wizard, however I can't add any records via the ADP. The add record icon in the tables is grayed out and if I create a form and attempt to add a record via the form I get "You can't go to the specified record" prompt.

If I create a blank database and connect to the SQL server db using linked tables I can add records no problem.

Any idea what I am doing wrong?

Thanks in advance!
 
I've never actually done anything like that.

All transactions on my back end are done through stored procedures and in the front end, I use ado to run those stored procedures...

--------------------
Procrastinate Now!
 
Do your tables have a primary key? If not, add one (even if just an identity column) then see if it works.
 
ajrimmer - Thanks! The lack of the primary key was my problem.

Crowley - Thanks for your response I started looking at using stored procs and ado yesterday - just wondering if you knew of any good resources on learning ado - I googled around and found some but thought you might have some additional insight
 
resources?

there's nothing to ado...

open a connection:
dim cn as new adodb.connection
cn.open "ConnectionString"

open a recordset:
dim rs as new adodb.recordset
rs.open "Sql String", "ConnectionString

working with Parameters:
dim cn as new adodb.connection
dim cmd as new adodb.command
cn.Open "ConnectionString"
with cmd
set .activeconnection = cn
.commandType = adcmdstoredproc
.commandText = "StoredProcedureName"

.parameters("@InParam1") = SomeValue

.execute

debug.print .parameters("@OutParam1")
debug.print .parameters(0) 'return parameter
end with

if you're returning a recordset, then just do:
set rs = .execute

that's pretty much all I've needed from ado...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top