Solved

VB recordset with Sybase SQL Anywhere

Posted on 2002-05-16
4
292 Views
Last Modified: 2006-11-17
Hi,
Suppose I have 2 tables:

 tblCustomers             tblContacts
PK noCust                PK noContact
   nameCust                 nameContact
                         FK noCust

noCust and noContact have a default value of autoincrement.

My problem is that, with MS Access 97, I can't had a customer and a contact at the same time:

        rstCust.AddNew
        rstCust!nameCust = Me.nameCust
        rstCust.Update
       
        rstCust.Bookmark rstCust.LastModified            

        rstContacts.AddNew
        rstContacts!nameContact = Me.nameContact
ERROR-> rstContacts!noCust = rstCust.noCust
        rstContacts.Update

I have a message that says that my record has been deleted. Is there a way (there should be) to make this work? All I want to do is to add those records in the same "transaction".

Any help would be appreciated, thanks
Jeff
0
Comment
Question by:jeanfrancoismelancon
4 Comments
 

Author Comment

by:jeanfrancoismelancon
ID: 7013774
And my problem is with the autoincrement clause... I can't get back the value of noCust... the bookmark/lastmodified dosen't seem to work.
0
 

Accepted Solution

by:
EggSpurt earned 100 total points
ID: 7392259
Jeff,

I don't have a very satisfactory answer (maybe you do by now in which case please share it) but I've had a similar problem trying to use addnew. In my case I entered values for several fields at once, all the fixed length data types updated successfully but long varchar/text fields remain blank. Though this doesn't cause an error on the .update command it throws up errors if you subsequently try to read or work with the values that failed to add.
One workaround which may work here is to update and close the recordset then immediately reopen a recordset on this record (in your case where nameCust = Me.nameCust).
I think you would then be able to read rstCust!noCust
In my case I was then able to edit the record and enter the values for all the long varchars etc.
I'm still searching for a proper explanation and solution which is how I came across your question.

Cheers,
John
0
 
LVL 6

Expert Comment

by:ChrisKing
ID: 9949345
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:

Accept: EggSpurt

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

ChrisKing
EE Cleanup Volunteer
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Employees depend heavily on their PCs, and new threats like ransomware make it even more critical to protect their important data.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

786 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