Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access frontend with a SQL Server backend

Posted on 2003-11-20
9
Medium Priority
?
2,014 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
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 152 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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 148 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

886 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