Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 February 12th, 2007, 04:54 PM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to scandalous Send a message via MSN to scandalous
Default Transfering an entry

This is new I have made it so a field populates on another form but for some reason this isnt working. This is the code I am using on my Button

Private Sub cmdCreateQuote2_Click()

'Save the record
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

'Open a new quote
DoCmd.OpenForm "frmCreateQuote", acNormal, , , acFormAdd

'Transfer CustomerID to New Form
Forms!frmCreateQuote!CustomerID = Forms!AddCustomer!CustomerID

'Close AddCustomer
DoCmd.Close

Other Info:
-the screen opens and closes
-I tried moving the DoCmd.Close up in the order and the frmcreate quote opens but then I get an error in the line that says:

Forms!frmCreateQuote!CustomerID = Forms!AddCustomer!CustomerID

-I triple checked the field names they are correct

As usual I am probably missing something simple.

 
Old February 13th, 2007, 08:36 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

If you want to pass data between forms, the easiest way I have found is with public variables.

Create a module, and then add this line to the module:

Public pCustID As Integer

'I am assuming that the customer ID you are passing is an autonumber.

Then on the On Click event of the button to open the frmCreateQuote, just open the form, and put this code in:

pCustID = Me.CustomerID

Then on the On Load or On Open event of the frmCreateQuote form, put this code:

Me.CustomerID = pCustID

Did that work?



mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfering enteries in the same form scandalous Access 3 February 22nd, 2007 11:15 AM
Transfering report Hudson40 Access VBA 1 March 11th, 2005 11:00 AM
Transfering elements from a vector to another aldo_izzo J2EE 0 June 8th, 2004 04:44 PM
Transfering data from one machine to another..... nikosdra SQL Server 2000 0 September 6th, 2003 05:08 AM
Transfering Import Specs Morris Access 3 August 15th, 2003 08:09 AM





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