Duplicating value from a form

C

chooriang

Hi,
I have a form which data base to a query.I want the value I entered in to
this form,duplicated to another field on another table or queries.Is that
possible?
How to do it.
Would somebody like to help.
 
M

missinglinq via AccessMonster.com

In the Objects dialog box click on Modules. If there is already a module
present click on it to open. If there are no modules, create one. Near the
top , just under "Option Compare Database" you need to declare a global
variable, depending on the data type of the value you want to re-use. For a
string value it would be something like


Public strCurrentClient As String

Close and save the module, naming it if necessary.

Now, from anywhere within your database, you can assign a value to this
variable i.e.

strCurrentClient = txtClientName

After this is done, from anywhere else in your database, you can use
strCurrentClient and the value you assigned it will be plugged in. This
variable will retain the value until you 1) Re-assign another value to
strCurrentClient or 2) You close the database.
 
H

Hung.cao

chooriang said:
Hi,
I have a form which data base to a query.I want the value I entered in to
this form,duplicated to another field on another table or queries.Is that
possible?
How to do it.
Would somebody like to help.

The best way to do it... you may want to wite the code to update the
value for the other field on other table and place it on the exist
property on the field you enter the value.

Here is some example,
value = XXXXXX xxxxx is where you're enter the value

Click on the field property and put some like the below on the exist
property of this field

If me!Value > "" Then
SQL = "SELECT * FROM tbl_othertable;"
Set rst = CurrentDb.OpenRecordset(SQL, dbOpenDynaset)
rst.AddNew
rst!value = Me!Value
rst.Update
rst.Close
Endif

It will add the value your just enter to another field in another
table. Hope it helps. If you want to go some further check you may
want to validate the value before to the add which you may want to add
the where clause behind the SQL statement. GL.
 
H

Hung.cao

chooriang said:
Hi,
I have a form which data base to a query.I want the value I entered in to
this form,duplicated to another field on another table or queries.Is that
possible?
How to do it.
Would somebody like to help.

The best way to do it... you may want to wite the code to update the
value for the other field on other table and place it on the exist
property on the field you enter the value.

Here is some example,
value = XXXXXX xxxxx is where you're enter the value

Click on the field property and put some like the below on the exist
property of this field

If me!Value > "" Then
SQL = "SELECT * FROM tbl_othertable;"
Set rst = CurrentDb.OpenRecordset(SQL, dbOpenDynaset)
rst.AddNew
rst!value = Me!Value
rst.Update
rst.Close
Endif

It will add the value your just enter to another field in another
table. Hope it helps. If you want to go some further check you may
want to validate the value before to the add which you may want to add
the where clause behind the SQL statement. GL.
 
Top