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 / February 2005

Tip: Looking for answers? Try searching our database.

add record to another form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tina - 14 Feb 2005 16:03 GMT
Hi
I have a command button which opens a form(returns) I would like to copy 2
fields in active record to next record in returns  form (works order and fg
code)
I am use to writing in vb but not vba
please give example code if possible
Thanks
tina
Brian - 14 Feb 2005 21:05 GMT
Declaring a variable to be used to transfer the value between the current &
new records

In declarations section of the form's module:
 Private worksOrderTemp as String (or whatever type you need)
 Private fgCodeTemp as String

Add these two lines on click of button that takes you to new record.

ButtonNew_Click()
 worksOrderTemp = worksOrder '(use actual name of your works order control)
 fgCodeTemp = fgCode

Add this to Form_Current

Form_Current()
If Form.NewRecord then 'do not change the fields on old records
 worksOrder = worksOrderTemp
 fgCode = fgCodeTemp
Else ' get value from existing record if it is not being changed
 worksOrderTemp = worksOrder
 fgCodeTemp = fgCode
End If

You may want to accomodate the possibility of going to a new record
immediately upon opening the form (in which case both variables would be
null).

> Hi
> I have a command button which opens a form(returns) I would like to copy 2
[quoted text clipped - 4 lines]
> Thanks
> tina
 
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.