Solved

VB recordset with Sybase SQL Anywhere

Posted on 2002-05-16
4
268 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
A procedure for exporting installed hotfix details of remote computers using powershell
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now