max in text box

F

Florin

I have a form bound to a table with a number field called NRCTR.
On the form, I have 2 text box.
In first text box I have max value (M) of field NRCTR .
How can I get automatically, in second text box - when I open the form, the
M+1,
without click on first text box 1?

Thanks
 
A

Arvin Meyer [MVP]

Set the controlsource property of the second textbox to:

= Forms![Name of Form]![Name of Textbox 1] + 1
 
F

Florin

Isn't a solution, because Textbox1 isn't active when I load the form.
For this reason, second text remain empty.


Arvin Meyer said:
Set the controlsource property of the second textbox to:

= Forms![Name of Form]![Name of Textbox 1] + 1
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Florin said:
I have a form bound to a table with a number field called NRCTR.
On the form, I have 2 text box.
In first text box I have max value (M) of field NRCTR .
How can I get automatically, in second text box - when I open the form,
the M+1,
without click on first text box 1?

Thanks
 
A

Arvin Meyer [MVP]

You can only refer to the data that exists in a textbox. If it doesn't
contain data when the form opens, you'll need to use the AfterUpdate event
to read the data into another textbox.

Sub Text1_AfterUpdate()
Me.Text2 = Me.Text1 + 1
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Florin said:
Isn't a solution, because Textbox1 isn't active when I load the form.
For this reason, second text remain empty.


Arvin Meyer said:
Set the controlsource property of the second textbox to:

= Forms![Name of Form]![Name of Textbox 1] + 1
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Florin said:
I have a form bound to a table with a number field called NRCTR.
On the form, I have 2 text box.
In first text box I have max value (M) of field NRCTR .
How can I get automatically, in second text box - when I open the form,
the M+1,
without click on first text box 1?

Thanks
 
F

Florin

In text box 1, I have max value (M) of field NRCTR.
I don't modify value in text1 (I don't "make" any event, click or enter).
When I open the form, how can I get automatically, in second text box
value M+1,without click on first text box 1?

Thanks



Arvin Meyer said:
You can only refer to the data that exists in a textbox. If it doesn't
contain data when the form opens, you'll need to use the AfterUpdate event
to read the data into another textbox.

Sub Text1_AfterUpdate()
Me.Text2 = Me.Text1 + 1
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Florin said:
Isn't a solution, because Textbox1 isn't active when I load the form.
For this reason, second text remain empty.


Arvin Meyer said:
Set the controlsource property of the second textbox to:

= Forms![Name of Form]![Name of Textbox 1] + 1
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

I have a form bound to a table with a number field called NRCTR.
On the form, I have 2 text box.
In first text box I have max value (M) of field NRCTR .
How can I get automatically, in second text box - when I open the
form, the M+1,
without click on first text box 1?

Thanks
 
A

Arvin Meyer [MVP]

Again, If the form has data when the form opens, set the controlsource of
the second textbox to:

=Forms![Name of Form]![Name of Textbox 1] + 1

If it does not have data, you will need to use the function below in the
first text box's AfterUpdate event.

Unless you have another problem, those are your 2 possibilities.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Florin said:
In text box 1, I have max value (M) of field NRCTR.
I don't modify value in text1 (I don't "make" any event, click or enter).
When I open the form, how can I get automatically, in second text box
value M+1,without click on first text box 1?

Thanks



Arvin Meyer said:
You can only refer to the data that exists in a textbox. If it doesn't
contain data when the form opens, you'll need to use the AfterUpdate
event to read the data into another textbox.

Sub Text1_AfterUpdate()
Me.Text2 = Me.Text1 + 1
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Florin said:
Isn't a solution, because Textbox1 isn't active when I load the form.
For this reason, second text remain empty.


Set the controlsource property of the second textbox to:

= Forms![Name of Form]![Name of Textbox 1] + 1
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

I have a form bound to a table with a number field called NRCTR.
On the form, I have 2 text box.
In first text box I have max value (M) of field NRCTR .
How can I get automatically, in second text box - when I open the
form, the M+1,
without click on first text box 1?

Thanks
 

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