PC Review


Reply
Thread Tools Rate Thread

add record to another form

 
 
=?Utf-8?B?dGluYQ==?=
Guest
Posts: n/a
 
      14th Feb 2005
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?QnJpYW4=?=
Guest
Posts: n/a
 
      14th Feb 2005
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).

"tina" wrote:

> 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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If I open a form, add a new record, close the form (without saving or changing records) will it still save the new record? Chris K Microsoft Access Form Coding 1 5th Sep 2010 01:25 AM
Open a record on a form depending on the record of another form Tony Microsoft Access Getting Started 5 14th Jan 2010 10:23 AM
Form (new record) based on open form record =?Utf-8?B?S0Bmb3NzLWRlbnRhbA==?= Microsoft Access Forms 7 29th Jun 2006 02:21 AM
Synchronizing main form record with pop-up form record Kathy Microsoft Access Form Coding 2 19th Feb 2004 02:27 AM
I am trying to get a form to pick up the record data from a different record to this new record Thomas Simsion Microsoft Access Forms 4 10th Nov 2003 09:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:19 PM.