Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB recordset with Sybase SQL Anywhere

Posted on 2002-05-16
4
Medium Priority
?
350 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
[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
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 400 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this article, I’ll show how research, determination, and use of modern technology helped me solve a DNA mystery.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

715 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