Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Table Default as form control? 1

Status
Not open for further replies.

alr0

Programmer
May 9, 2001
211
US

Hi All,

I am trying to set the default value for a table field based on a form field and an auto number field to create a unique ID across all of our work.

When I enter the expression:

=Right([Form]![frmWkDt]![txtReqNo],10) & [idwo]

I get the error message:

"Could not fine field 'Form]![frmWkDt]![txtReqNo'."

So of course I try just the form reference:

=[Form]![frmWkDt]![txtReqNo]

and I get the same error message.

This is almost an exact copy out of the help on default values, =Forms!frmInvoice!txtShipTo so I am puzzled. The form is open and has an appropriate value in the field in question. I thought the missing brackets in the error message might be a clue so I tried adding a few quotes but that just saves the default as text. Any ideas what I am doing wrong?

Thanks,

alr


_____________________________________
There is no rule more invariable than that we are paid for our suspicions by finding out what we expected.

Henry David Thoreau
 
When you say default value, do you mean the property? Is frmWkDt the same form as the form you want to set the default for? Have you carefully checked all the names?
 
Hi Remou,

I am setting the default for a new field in a table and the value is coming from a form.

I have triple checked the names and pasted the names from their source just to be sure.

Is this something I should be able to do? It sure seems like it should be doable. The form has no record source so all controls are unbound but that should be OK, right?

Thanks,

alr

_____________________________________
There is no rule more invariable than that we are paid for our suspicions by finding out what we expected.

Henry David Thoreau
 
I am pretty sure you cannot do this with a table. You can create the table and then use a form to set the default. I think, however, you would be better off storing your key field in a separate table and looking it up when creating a record. Have a look in the FAQs for MichaelRed's post on autonumbers (and why not autonumbers) for some nice ideas.
 
Remou,

Thanks for looking into this but the help in table design on default values describes exactly what I want to do! So it should be possible. In fact it is the only sure way to populate this field since records can be added many different ways.

Am I doing something wrong?

Thanks,

alr

_____________________________________
There is no rule more invariable than that we are paid for our suspicions by finding out what we expected.

Henry David Thoreau
 
Note the use of the word 'control' in help:

One control can provide the default value for another control. For example, if you set the DefaultValue property for a control to the following expression, the control's default value is set to the DefaultValue property setting for the txtShipTo control.

=Forms!frmInvoice!txtShipToIf the controls are on the same form, the control that's the source of the default value must appear earlier in the tab order than the control containing the expression.​

Control refers to a form, not a table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top