Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2005

Tip: Looking for answers? Try searching our database.

How to carry data from one form to another, control referencing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marjorie - 28 Apr 2005 09:28 GMT
Please help if you can:

I have a combo box on a form (frmTest) that contains zipcodes.  In the
'notinlist' function, I have working code that asks, "Do you want to add
'11122' to the zipcode table?" Yes/No.  If you choose yes, then the data
entry form (frmZipcode) opens to add a zipcode, city, and state.  Closing
this form saves the new zip, etc.; closes the zip data entry, and advances to
the next new record on frmTest.

The problem:  If a person enters a zipcode (22211) on frmTest, and they
choose to enter it into frmZipcode, I do NOT want them to have to retype the
zipcode on frmZipcode...I want it to 'carry over' from the first form where
they first entered it.  I know that I'm missing something easy
here...something wrong with referencing the field or something.  I would
greatly appreciate any help.

Here's the code on the not in list:
Public Sub Zip_NotInList(NewData As String, Response As Integer)

   If MsgBox("Do you want to add '" & NewData & "' to the zipcode table?",
vbOKCancel, "Add New Item?") = vbOK Then
       
       'Remove new data from combo box so control requeries
       DoCmd.RunCommand acCmdUndo
               
       'Display Zipcode form to collect new data.
       DoCmd.OpenForm "frmtblZipcode", acNormal, , , acFormAdd, acDialog,
NewData
 
     
       'Continue without displaying default error message.
       Response = acDataErrAdded
   Else
       Response = acDataErrContinue
   End If
   
   
End Sub

============
I was trying something like: (which I know is wrong)
Forms![frmtblZipcode]![Zipcode] = NewData

HELP!!!!!!!!!!!!!!

Have a great day,
Marjorie
Alex Dybenko - 28 Apr 2005 12:43 GMT
Hi,

in a form's frmtblZipcode load event set ZipField default value to
me.openargs (you pass there NewData )

HTH
Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

> Please help if you can:
>
[quoted text clipped - 44 lines]
> Have a great day,
> Marjorie
Marjorie - 06 May 2005 16:54 GMT
Thanks!  Worked like a charm!

> Hi,
>
[quoted text clipped - 50 lines]
> > Have a great day,
> > Marjorie
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.