Solved

Access frontend with a SQL Server backend

Posted on 2003-11-20
9
2,008 Views
Last Modified: 2007-12-19
I have an MS Access frontend with a SQL Server backend. On several of my forms, I have a textbox bound to the primary key of the table. When the backend was solely in MS Access, the primary key would show up as soon as you start making the record. But this is not the case now that the backend is in SQL. The primary key value doesn't show up until you move off the record and comer back to it.

My problem is that I make use of the primary key value before the user gets off the record, so since it is NULL now - my code is crashing. Is there a solution to this.
0
Comment
Question by:tyy8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 32

Expert Comment

by:jadedata
ID: 9788937
Hey tyy8!

 You will have to modify your code somehow to work with this change in MO by the two different databases.
 Is there any other way to identify the record recently entered to return to IT specifically?
regards
Jack
0
 

Author Comment

by:tyy8
ID: 9789705
I need to send the primary key into some other tables, so I need to set that up before the user leaves the record and goes to view those other tables.
0
 
LVL 32

Accepted Solution

by:
jadedata earned 38 total points
ID: 9789733
Set up an SQL trigger on the table to Stick this number into the other table as soon as its available.  The Access code that does this now would then become obsolete because SQL Server would handle it.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tyy8
ID: 9789971
But I also need to send that users ID (for tracking the user's activity), and some other stuff that the trigger would never have available to it.
0
 
LVL 32

Expert Comment

by:jadedata
ID: 9789984
I guess I just don't understand all that is in play here...
0
 
LVL 2

Assisted Solution

by:thorkyl
thorkyl earned 37 total points
ID: 9798989
if me.dirty then me.dirty=false

now the record is saved and you have your key

now you can do what you need to with it.

or as stated above

Create and AFTER INSERT trigger

DECLARE @PK int
AS
@PK=@@IDENTITY
--D0 you your thing using the new key @PK
0
 
LVL 9

Expert Comment

by:ornicar
ID: 10066325
----------------------------------------------------------------------------------------
This question has been abandoned and needs to be finalized.
 You can accept an answer, split the points, or get a refund (information at http:/help.jsp#hs5)
  If you need a moderator to help you, post a question at Community Support (http:/Community_Support/)

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

ornicar
Cleanup Volunteer

---------------------------------------------------------------------------------------------
0
 
LVL 32

Expert Comment

by:jadedata
ID: 10083886
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: jadedata {http:#9789733} & thorkyl {http:#9798989}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jadedata
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

623 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