Theodore-

Your code should look like:

  "WHERE OfferID = " & Me.OfferID

In the sample code I sent you, it saves the new OrderID after doing AddNew
on the orders table to create the new order.  Use that value as a constant
in the INSERT you create to copy rows from OfferDetails to OrderDetails.
The SQL will look something like:

"INSERT INTO tblOrders " & _
"(OrderID, Field2, Field3, Field4) " & _
"(SELECT " & lngOrderNum & " As OrderID, " & _
"Field2, Field3, Field4 " & _
"FROM tblOfferDetails " & _
"WHERE OfferID = " & Me.OfferID

John Viescas, author
"Building Microsoft Access Applications"
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/

> -----Original Message-----
> From: [email protected] 
> [mailto:[EMAIL PROTECTED] On Behalf Of tyki9799
> Sent: Wednesday, June 22, 2005 6:45 AM
> To: [email protected]
> Subject: [ms_access] Re: Moving records between tables
> 
> 
> Hi again John! If you checked my other message on DevGroup you'll know
> I 'm just recovering...
> 
> Well, I have troubles. I cannot get how to set the current records'
> (the one open in form frmOffers) OfferID field (the autonumber primery
> key) on the WHERE clause for the 
> 
> "SELECT * FROM tblOffers WHERE ...") query. (The query used to select
> the right record to amend it to an Order.)
> 
> I guess it should be something like "WHERE OfferID = Me.OfferID") but
> when I proceed to apply exactly that then I get an error message.
> 
> Also when sending the records from tblOfferDetails to tblOrderDetails
> I don't know how to specify the new entry for these records OrderID
> field to be the new Order's OrderID. You see Orders and their
> respective ordered Items in tables tblOrders and tblOrderDetails share
> the same OrderID. So when Offers are turned into Orders, their
> respective items must be attached to the new OrderID.
> 
> Regards,
> 
> Theodore
> 
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to