Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 30th, 2007, 04:29 PM
Registered User
 
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help: Multi User Order Entry Screen

Hi - I'm using VBE to write a project tracker application which uses a Master-Detail setup.

I have no problem using my "change/edit order" form because the order has already been assigned the "OrderID" (autonumber) which my detail lines automatically relate to.

My goal is to have a "Create Order" form, which does not load ANY of the existing rows into the Table Adapter, and only references the database when I call "OrdersTableAdapter.update(ordersdataset.tblorders )"

I currently have the following:
"OrdersTableAdapter"
"OrdersBindingSource"
"DetailsTableAdapter"
"DetailsBindingSource"

In my "Form_Load" I have "OrdersBindingSource.addnew()" which creates a new order and assigns it an "OrderID" of "-1". My Details datagrid then shows 1 empty line for users to begin entering information. As info is entered, the lines are all automatically assigned an "orderID" of "-1".

The problem is - when I do "OrdersBindingSource.endedit()" and "OrdersTableAdapter.update(ordersdataset.tblorders )" - the table adapter THEN adds the line to the physical database, and updates the "OrderID" to the next autonumber (i.e. 159, 200, 5000 whatever...) but then all of my detail lines are lost, because they are not related to the NEW orderID number.

How can I make my details "OrderID" update (either automatically, or via code) to the newly assigned orderID and then be saved to my "tblDetails" before they are lost?

Thanks...
Chris






Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms or a solution for end user data entry? Scott B SQL Server 2005 0 October 19th, 2007 04:21 AM
Multi-field entry design and reporting Nanette Access 2 October 26th, 2006 11:02 AM
What Syntax to use in Coding order entry system? srswedeen Access VBA 2 October 20th, 2005 08:58 AM
is this user on/offline? boolean db entry? ALEX_GRIM Classic ASP Basics 6 February 5th, 2005 06:30 AM
User Entry MrDannyP Beginning VB 6 2 December 3rd, 2003 10:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.