HELP-- Is it possible to make the default value of a field...

V

Vernon

Is it possible to set the default value of a field to
include the data from a different field in the same
table/record? Example:

Record 1
[ID] = 001
[Field2] = ABC001

Record 2
[ID] = 002
[Field2] = ABC002

I tried using: Default Value ="ABC" & [ID]
but it doesn't seem to work. Any help would be greatly
appreciated!!!
 
T

Tim Ferguson

Is it possible to set the default value of a field to
include the data from a different field in the same
table/record?

At the time of assigning Default Values to their fields, there are _no_
values in the other fields, so no.
[ID] = 002
[Field2] = ABC002
I tried using: Default Value ="ABC" & [ID]



These questions practically always reveal a Design Problem, and this one is
no exception. If the Field2 value always looks like this, then it should
not be there at all: the ABC should be added in the textbox or in the
query. On the other hand, if the ABC part changes from time to time, then
it should be in a separate field, and the combined ID string can be
displayed in a text box or in the query.

The final possibility, that the "002" part of Field2 might change over
time, so that it no longer corresponds with ID, needs a design as above,
but the procedure that allocates the ID field would copy it to the Field2
as long as the user has not already entered the correct value. Slightly
more sensitive programming required.

The bottom line is that, whatever you want to do here, it can be done; but
not in the way you have suggested in your question.

Hope that helps



Tim F
 
J

John Vinson

Is it possible to set the default value of a field to
include the data from a different field in the same
table/record? Example:

No, you cannot - not in a table.

One question: WHY? It looks like you're storing data redundantly,
which is never a good idea. Is this a true default, that is, do you
want to enter 123 and have ABC123 appear in the other field, but allow
the user to change it to ABC321 or to XYZ123? or is the second field
in fact just a different way of displaying the same value? If so, it
should be calculated on the fly, and NOT stored in the table at all.
 
V

Vernon

I probably should have been more specific . . . in my
example, [Field2] is a HYPERLINK. I am using the [ID]
field as the filename of the file that will be launched
by clicking on the hyperlink. The "ABC" is actually the
UNC address . . . like: \\server\share\ABC\[ID]

Currently, I set the default value of the HYPERLINK field
to the UNC path . . . but the user must type in the
filename (which is the [ID] + extension). I would like
to automate this (the extension is always the same).

I tried using an unbound textbox on a form to concatenate
values to make a hyperlink. I set the "Is Hyperlink"
property of the unbound textbox to YES . . . but it
doesn't act like a hyperlink.

Thanks again. Vernon
-----Original Message-----
Is it possible to set the default value of a field to
include the data from a different field in the same
table/record?

At the time of assigning Default Values to their fields, there are _no_
values in the other fields, so no.
[ID] = 002
[Field2] = ABC002
I tried using: Default Value ="ABC" & [ID]



These questions practically always reveal a Design Problem, and this one is
no exception. If the Field2 value always looks like this, then it should
not be there at all: the ABC should be added in the textbox or in the
query. On the other hand, if the ABC part changes from time to time, then
it should be in a separate field, and the combined ID string can be
displayed in a text box or in the query.

The final possibility, that the "002" part of Field2 might change over
time, so that it no longer corresponds with ID, needs a design as above,
but the procedure that allocates the ID field would copy it to the Field2
as long as the user has not already entered the correct value. Slightly
more sensitive programming required.

The bottom line is that, whatever you want to do here, it can be done; but
not in the way you have suggested in your question.

Hope that helps



Tim F

.
 
T

Tim Ferguson

Currently, I set the default value of the HYPERLINK field
to the UNC path . . . but the user must type in the
filename (which is the [ID] + extension). I would like
to automate this (the extension is always the same).

In that case, you are probably looking to a cmd button that does something
like

FollowHyperlink(UNCPath & FileName & c_strExtension)

or use the Shell() function, or sticking it into an Internet object, or
whatever. There is still no reason -- or practical method -- to keep one
field dependent on another. That's second normal form for you!

Hope that helps


Tim F
 

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