Update Form1 with field from Form2

P

PC

Hi,

I have a Field [FileRef] in Form1 which is a data entry form which updates
Table1. Beside [FileRef] I have a command button which opens Form2. Form2
contains only one textbox [txtNewFileRef] which displays the last entry in
[Table1]![FileRef] plus 1. (AutoNumber would not work in this case for a
number of reasons)

I would like to have a command button on Form2 which when clicked appends
this value to the [FileRef] field on Form1. I realise this is an OnClick
event but I'm lost when it comes to the code. Any ideas?

Thanks in advance.

...pc
 
W

Wayne Morgan

You can refer to a control on another form (the form has to be open, but can be hidden)
with syntax similar to:

Forms!frmNameOfForm!NameOfControl

If the control is actually on a subform of the other form, it gets a little longer:

Forms!frmNameOfForm!NameOfSubformControl.Form!NameOfControl
 
P

PC

Thanks for the reply.

What I want is for the user to have the option of clicking a button on form2
if they want to use the next number in the sequence. i.e. the number
displayed in [txtNewFileRef] (The number displayed may not be the number
they want to use - its just a reference)

Thanks


Wayne Morgan said:
You can refer to a control on another form (the form has to be open, but can be hidden)
with syntax similar to:

Forms!frmNameOfForm!NameOfControl

If the control is actually on a subform of the other form, it gets a little longer:

Forms!frmNameOfForm!NameOfSubformControl.Form!NameOfControl

--
Wayne Morgan


Hi,

I have a Field [FileRef] in Form1 which is a data entry form which updates
Table1. Beside [FileRef] I have a command button which opens Form2. Form2
contains only one textbox [txtNewFileRef] which displays the last entry in
[Table1]![FileRef] plus 1. (AutoNumber would not work in this case for a
number of reasons)

I would like to have a command button on Form2 which when clicked appends
this value to the [FileRef] field on Form1. I realise this is an OnClick
event but I'm lost when it comes to the code. Any ideas?

Thanks in advance.

..pc
 
W

Wayne Morgan

In the OnClick event of the button on the form with the one textbox you would use
something like:

Forms!NameOfOtherForm!NameOfControlOnOtherForm = Me.txtnewFileRef

--
Wayne Morgan


PC said:
Thanks for the reply.

What I want is for the user to have the option of clicking a button on form2
if they want to use the next number in the sequence. i.e. the number
displayed in [txtNewFileRef] (The number displayed may not be the number
they want to use - its just a reference)

Thanks


Wayne Morgan said:
You can refer to a control on another form (the form has to be open, but can be hidden)
with syntax similar to:

Forms!frmNameOfForm!NameOfControl

If the control is actually on a subform of the other form, it gets a little longer:

Forms!frmNameOfForm!NameOfSubformControl.Form!NameOfControl

--
Wayne Morgan


Hi,

I have a Field [FileRef] in Form1 which is a data entry form which updates
Table1. Beside [FileRef] I have a command button which opens Form2. Form2
contains only one textbox [txtNewFileRef] which displays the last entry in
[Table1]![FileRef] plus 1. (AutoNumber would not work in this case for a
number of reasons)

I would like to have a command button on Form2 which when clicked appends
this value to the [FileRef] field on Form1. I realise this is an OnClick
event but I'm lost when it comes to the code. Any ideas?

Thanks in advance.

..pc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top