Default values

  • Thread starter Thread starter frankrkwright
  • Start date Start date
F

frankrkwright

I have a form, Inbox, for which the inputs are listed, as follows:
ID Integer e.g. 250;
Subject Text e.g. January timesheet;
Author Text e.g. Fred Bloggs;
Date Sent Date Date();
Project Text e.g. Admin;
Topic Text e.g. HR;
Reference Hyperlink

I want the Reference to be automatically updated from inputs, e.g.
"mailbox\In\Admin_HR_250".

I've tried inserting ="mailbox\In\" & [Project] & "_" &
& "_" & [ID] in
the Default value for "Reference" but it doesn't work. Is my coding wrong or
do I have to use a control? I'd be grateful for any help with coding for
Default value or Control.
Thanks, frank
 
You can't set a default in that way, it won't work.

Generally speaking it is not a good idea to save derived data in the table,
because it creates possibly conflicting data. Where information in one field
is derived from another then it is best to bulid the derived information as
and when you need it. It is a good design principle that you should NEVER
store the same information twice.

I presume you have initially created a bound form and set the recordsource of
the form to the table, or you built the form with the form wizard and chose
the table, either way your form recordsource is currently the table.

Edit the recordsource property of your form - in the form propertiesselect
the recordsource property and build it using the ... button.

Confirm that you want to build a query.

From the table drag down the * into the bottom and then in the top row of the
second column type

url: "mailbox\In" & [Project] & "_" & [Topic] & "_" &[ID]

This will give you an extra field in your recordsource and you can include
the url: expression as a controlsource for a text box on the form.

You will notice that if you now try to edit the url then you will be told:

Field url is based on an expression and can't be edited. That's how you want
it to work, you'll still find that project and topic are still editable.

I hope that helps. Let me know if any of the above isn't clear.

Dave Boyle
I have a form, Inbox, for which the inputs are listed, as follows:
ID Integer e.g. 250;
Subject Text e.g. January timesheet;
Author Text e.g. Fred Bloggs;
Date Sent Date Date();
Project Text e.g. Admin;
Topic Text e.g. HR;
Reference Hyperlink

I want the Reference to be automatically updated from inputs, e.g.
"mailbox\In\Admin_HR_250".

I've tried inserting ="mailbox\In\" & [Project] & "_" &
& "_" & [ID] in
the Default value for "Reference" but it doesn't work. Is my coding wrong or
do I have to use a control? I'd be grateful for any help with coding for
Default value or Control.
Thanks, frank

 
sorry should be url: "mailbox\In\" & [Project] & "_" & [Topic] & "_" &[ID]
I have a form, Inbox, for which the inputs are listed, as follows:
ID Integer e.g. 250;
Subject Text e.g. January timesheet;
Author Text e.g. Fred Bloggs;
Date Sent Date Date();
Project Text e.g. Admin;
Topic Text e.g. HR;
Reference Hyperlink

I want the Reference to be automatically updated from inputs, e.g.
"mailbox\In\Admin_HR_250".

I've tried inserting ="mailbox\In\" & [Project] & "_" &
& "_" & [ID] in
the Default value for "Reference" but it doesn't work. Is my coding wrong or
do I have to use a control? I'd be grateful for any help with coding for
Default value or Control.
Thanks, frank

 
Thanks; it worked

BUT .............

still figuring out how to make use of it because I can't SEE it until I open
the Query builder. I guess I have to create a report based on the Query?

DavidBoyle via AccessMonster.com said:
sorry should be url: "mailbox\In\" & [Project] & "_" & [Topic] & "_" &[ID]
I have a form, Inbox, for which the inputs are listed, as follows:
ID Integer e.g. 250;
Subject Text e.g. January timesheet;
Author Text e.g. Fred Bloggs;
Date Sent Date Date();
Project Text e.g. Admin;
Topic Text e.g. HR;
Reference Hyperlink

I want the Reference to be automatically updated from inputs, e.g.
"mailbox\In\Admin_HR_250".

I've tried inserting ="mailbox\In\" & [Project] & "_" &
& "_" & [ID] in
the Default value for "Reference" but it doesn't work. Is my coding wrong or
do I have to use a control? I'd be grateful for any help with coding for
Default value or Control.
Thanks, frank



 
If you use the query you've built as the rowsource of your form, you can then
include the expression in a text box, added via the control toolbox.
Thanks; it worked

BUT .............

still figuring out how to make use of it because I can't SEE it until I open
the Query builder. I guess I have to create a report based on the Query?
sorry should be url: "mailbox\In\" & [Project] & "_" & [Topic] & "_" &[ID]
[quoted text clipped - 15 lines]
 
Yes! Brilliant, makes life so much easier. Thanks.

I'll be back ....................

DavidBoyle via AccessMonster.com said:
If you use the query you've built as the rowsource of your form, you can then
include the expression in a text box, added via the control toolbox.
Thanks; it worked

BUT .............

still figuring out how to make use of it because I can't SEE it until I open
the Query builder. I guess I have to create a report based on the Query?
sorry should be url: "mailbox\In\" & [Project] & "_" & [Topic] & "_" &[ID]
[quoted text clipped - 15 lines]
Default value or Control.
Thanks, frank
 
glad to help

Yes! Brilliant, makes life so much easier. Thanks.

I'll be back ....................
If you use the query you've built as the rowsource of your form, you can then
include the expression in a text box, added via the control toolbox.
[quoted text clipped - 11 lines]
 
Back
Top