add record to another form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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).
 
Back
Top