Define a default value from a different form

Z

Zulay

Good morning all:

I want to set the default value of a textbox with the value entered in a
textbox on another form; a previous one. Right now, it is saving the ID
corresponding to the value entrered on the field, but what i want is the
value. For example, if in a previous form i have a textbox that asks the user
to enter their name, I want to retrieve that name and set the default value
of another textbox on another form to the name of the person. I'm using the
ID in other places so i can not eliminate that field easily and it is
possible that more that one person could be using the form at the same time.
Any advice will be really appreciated.

Thanks anticipated.
 
K

Klatuu

If you have multiple users sharing the same copy of your application, the
first thing you need to do is not do this.
The correct configuation when you have multiple users is to Split your
database using the database splitter wizard. Put the _be.mdb version on a
network shared folder where all users have read/write/delete privledges. Pu
a copy of the front end (the original mdb name) on each user's computer.
This is very important. Not only will there be conflict in this
circumstance, there will be other issues that can cause problems. In
addition, multiple users sharing one copy of an application on a network
folder doubles the network traffic.

Now the issue is whether the previous form is still open or not. If is is
open, you can reference it in the Default Value property of the the control:

=Forms!PreviousForm!ControlName

If the form opens the current form, but does not remain open, you can use
the OpenArgs argument to pass the value from the previous form to the current
form. See VBA Help for details on the OpenArgs.
 
Z

Zulay

Thanks Dave for your response.

I used the format =Forms!PreviousForm!ControlName, it is getting the
value of the ID that corresponds to the name, not the name of the person.
 
K

Klatuu

What is the control?
My guess it is a multi column combo where the ID is the first and invisible
column and the actual name is the second column. If that is the case, use:
=Forms!PreviousForm!ControlName.Column(1)
column numbers start with 0, so 1 is the second column.
 
Z

Zulay

Your guess was right. It is a combo box with 2 columns; first column is the
ID (which is hidden) and the second one is the name of the person.

I wrote =[Forms]![LogIn]![Username].[Column(1)] in the default value but an
error message is prompted. The message says: The object doesn't contain the
Automation object 'Column(1)'. Please advice.


Klatuu said:
What is the control?
My guess it is a multi column combo where the ID is the first and invisible
column and the actual name is the second column. If that is the case, use:
=Forms!PreviousForm!ControlName.Column(1)
column numbers start with 0, so 1 is the second column.
 
K

Klatuu

Try it like this:
=[Forms]![LogIn]![Username].[Column](1)
--
Dave Hargis, Microsoft Access MVP


Zulay said:
Your guess was right. It is a combo box with 2 columns; first column is the
ID (which is hidden) and the second one is the name of the person.

I wrote =[Forms]![LogIn]![Username].[Column(1)] in the default value but an
error message is prompted. The message says: The object doesn't contain the
Automation object 'Column(1)'. Please advice.


Klatuu said:
What is the control?
My guess it is a multi column combo where the ID is the first and invisible
column and the actual name is the second column. If that is the case, use:
=Forms!PreviousForm!ControlName.Column(1)
column numbers start with 0, so 1 is the second column.
 
Z

Zulay

I tried with =[Forms]![LogIn]![Username].[Column](1). Now it says: "The
method you tried to invoke on an object failed. You may have specified too
many or too few arguments for a property or method of an object".

Thanks again Dave.

Klatuu said:
Try it like this:
=[Forms]![LogIn]![Username].[Column](1)
--
Dave Hargis, Microsoft Access MVP


Zulay said:
Your guess was right. It is a combo box with 2 columns; first column is the
ID (which is hidden) and the second one is the name of the person.

I wrote =[Forms]![LogIn]![Username].[Column(1)] in the default value but an
error message is prompted. The message says: The object doesn't contain the
Automation object 'Column(1)'. Please advice.


Klatuu said:
What is the control?
My guess it is a multi column combo where the ID is the first and invisible
column and the actual name is the second column. If that is the case, use:
=Forms!PreviousForm!ControlName.Column(1)
column numbers start with 0, so 1 is the second column.
--
Dave Hargis, Microsoft Access MVP


:

Thanks Dave for your response.

I used the format =Forms!PreviousForm!ControlName, it is getting the
value of the ID that corresponds to the name, not the name of the person.

:

If you have multiple users sharing the same copy of your application, the
first thing you need to do is not do this.
The correct configuation when you have multiple users is to Split your
database using the database splitter wizard. Put the _be.mdb version on a
network shared folder where all users have read/write/delete privledges. Pu
a copy of the front end (the original mdb name) on each user's computer.
This is very important. Not only will there be conflict in this
circumstance, there will be other issues that can cause problems. In
addition, multiple users sharing one copy of an application on a network
folder doubles the network traffic.

Now the issue is whether the previous form is still open or not. If is is
open, you can reference it in the Default Value property of the the control:

=Forms!PreviousForm!ControlName

If the form opens the current form, but does not remain open, you can use
the OpenArgs argument to pass the value from the previous form to the current
form. See VBA Help for details on the OpenArgs.
 
K

Klatuu

I just tested it using a junk mdb I use for checking things out.
This worked for me:
=[Forms]![frmClientSearch]![cboFilterIsCorporate].[Column](1)

Remember the form you reference has to be open.
--
Dave Hargis, Microsoft Access MVP


Zulay said:
I tried with =[Forms]![LogIn]![Username].[Column](1). Now it says: "The
method you tried to invoke on an object failed. You may have specified too
many or too few arguments for a property or method of an object".

Thanks again Dave.

Klatuu said:
Try it like this:
=[Forms]![LogIn]![Username].[Column](1)
--
Dave Hargis, Microsoft Access MVP


Zulay said:
Your guess was right. It is a combo box with 2 columns; first column is the
ID (which is hidden) and the second one is the name of the person.

I wrote =[Forms]![LogIn]![Username].[Column(1)] in the default value but an
error message is prompted. The message says: The object doesn't contain the
Automation object 'Column(1)'. Please advice.


:

What is the control?
My guess it is a multi column combo where the ID is the first and invisible
column and the actual name is the second column. If that is the case, use:
=Forms!PreviousForm!ControlName.Column(1)
column numbers start with 0, so 1 is the second column.
--
Dave Hargis, Microsoft Access MVP


:

Thanks Dave for your response.

I used the format =Forms!PreviousForm!ControlName, it is getting the
value of the ID that corresponds to the name, not the name of the person.

:

If you have multiple users sharing the same copy of your application, the
first thing you need to do is not do this.
The correct configuation when you have multiple users is to Split your
database using the database splitter wizard. Put the _be.mdb version on a
network shared folder where all users have read/write/delete privledges. Pu
a copy of the front end (the original mdb name) on each user's computer.
This is very important. Not only will there be conflict in this
circumstance, there will be other issues that can cause problems. In
addition, multiple users sharing one copy of an application on a network
folder doubles the network traffic.

Now the issue is whether the previous form is still open or not. If is is
open, you can reference it in the Default Value property of the the control:

=Forms!PreviousForm!ControlName

If the form opens the current form, but does not remain open, you can use
the OpenArgs argument to pass the value from the previous form to the current
form. See VBA Help for details on the OpenArgs.
 
Z

Zulay

I tried once again and it finally worked! Thanks a lot for your help....

Klatuu said:
I just tested it using a junk mdb I use for checking things out.
This worked for me:
=[Forms]![frmClientSearch]![cboFilterIsCorporate].[Column](1)

Remember the form you reference has to be open.
--
Dave Hargis, Microsoft Access MVP


Zulay said:
I tried with =[Forms]![LogIn]![Username].[Column](1). Now it says: "The
method you tried to invoke on an object failed. You may have specified too
many or too few arguments for a property or method of an object".

Thanks again Dave.

Klatuu said:
Try it like this:
=[Forms]![LogIn]![Username].[Column](1)
--
Dave Hargis, Microsoft Access MVP


:

Your guess was right. It is a combo box with 2 columns; first column is the
ID (which is hidden) and the second one is the name of the person.

I wrote =[Forms]![LogIn]![Username].[Column(1)] in the default value but an
error message is prompted. The message says: The object doesn't contain the
Automation object 'Column(1)'. Please advice.


:

What is the control?
My guess it is a multi column combo where the ID is the first and invisible
column and the actual name is the second column. If that is the case, use:
=Forms!PreviousForm!ControlName.Column(1)
column numbers start with 0, so 1 is the second column.
--
Dave Hargis, Microsoft Access MVP


:

Thanks Dave for your response.

I used the format =Forms!PreviousForm!ControlName, it is getting the
value of the ID that corresponds to the name, not the name of the person.

:

If you have multiple users sharing the same copy of your application, the
first thing you need to do is not do this.
The correct configuation when you have multiple users is to Split your
database using the database splitter wizard. Put the _be.mdb version on a
network shared folder where all users have read/write/delete privledges. Pu
a copy of the front end (the original mdb name) on each user's computer.
This is very important. Not only will there be conflict in this
circumstance, there will be other issues that can cause problems. In
addition, multiple users sharing one copy of an application on a network
folder doubles the network traffic.

Now the issue is whether the previous form is still open or not. If is is
open, you can reference it in the Default Value property of the the control:

=Forms!PreviousForm!ControlName

If the form opens the current form, but does not remain open, you can use
the OpenArgs argument to pass the value from the previous form to the current
form. See VBA Help for details on the OpenArgs.
 
K

Klatuu

Oh, good. So at least I'm not as crazy as some say I am :)
Glad I could help.
--
Dave Hargis, Microsoft Access MVP


Zulay said:
I tried once again and it finally worked! Thanks a lot for your help....

Klatuu said:
I just tested it using a junk mdb I use for checking things out.
This worked for me:
=[Forms]![frmClientSearch]![cboFilterIsCorporate].[Column](1)

Remember the form you reference has to be open.
--
Dave Hargis, Microsoft Access MVP


Zulay said:
I tried with =[Forms]![LogIn]![Username].[Column](1). Now it says: "The
method you tried to invoke on an object failed. You may have specified too
many or too few arguments for a property or method of an object".

Thanks again Dave.

:

Try it like this:
=[Forms]![LogIn]![Username].[Column](1)
--
Dave Hargis, Microsoft Access MVP


:

Your guess was right. It is a combo box with 2 columns; first column is the
ID (which is hidden) and the second one is the name of the person.

I wrote =[Forms]![LogIn]![Username].[Column(1)] in the default value but an
error message is prompted. The message says: The object doesn't contain the
Automation object 'Column(1)'. Please advice.


:

What is the control?
My guess it is a multi column combo where the ID is the first and invisible
column and the actual name is the second column. If that is the case, use:
=Forms!PreviousForm!ControlName.Column(1)
column numbers start with 0, so 1 is the second column.
--
Dave Hargis, Microsoft Access MVP


:

Thanks Dave for your response.

I used the format =Forms!PreviousForm!ControlName, it is getting the
value of the ID that corresponds to the name, not the name of the person.

:

If you have multiple users sharing the same copy of your application, the
first thing you need to do is not do this.
The correct configuation when you have multiple users is to Split your
database using the database splitter wizard. Put the _be.mdb version on a
network shared folder where all users have read/write/delete privledges. Pu
a copy of the front end (the original mdb name) on each user's computer.
This is very important. Not only will there be conflict in this
circumstance, there will be other issues that can cause problems. In
addition, multiple users sharing one copy of an application on a network
folder doubles the network traffic.

Now the issue is whether the previous form is still open or not. If is is
open, you can reference it in the Default Value property of the the control:

=Forms!PreviousForm!ControlName

If the form opens the current form, but does not remain open, you can use
the OpenArgs argument to pass the value from the previous form to the current
form. See VBA Help for details on the OpenArgs.
 

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