Control source for text box

RichardMGreen

Well-known Member
Joined
Feb 20, 2006
Messages
2,177
Hi all

I'm trying to add a text box to a form so that a pre-saved value is populated when the form opens (it's a filepath).
I've got the form OK and the text box is in place but I can't get the text box to be bound to the field in the table. The properties field of the text box reads
=C4CDate!DefaultLocation

When I open the form, instead of the text box reading the saved filepath, it reads #NAME?

I know I'm doing something dim, but I can't see it.

Can someone point me in the right direction please?
If it helps I'm using Access 2003.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
OK, may have found the problem.
There were no bound items on the form.
Bound a table to it and all is now fine.
 
Upvote 0
OK, slightly different issue.
Using a bound text box, I get the editing arrow on the left hand side which I could do without (purely for aesthetic reasons).
Is it possible when the form is opened to read the contents of a field in a table (there's only one record) and put that in the text box as the default value?

I'm using the last known filepath (which is contained in the table) as the default value which the user can then overtype if they wish.

When all the other code has run, I'll be using an UPDATE statement to put whatever's in the text box back into the table and field.

For example:-
The current filepath is "C:\CSV Downloads" (this is held in a table called C4CDate in a field called DefaultFileLocation and should appear in the text box when the form is opened).
If I change the text box to read "C:\CSV Downloads\Data" then I'll be writing that back to the same table and field so it becomes the default the next time the form is opened.

Any help greatly appreciated.

::edit::

I've just tried adding this to the form_open event
Text1 = DoCmd.RunSQL("select defaultfilelocation from c4cdate")
but I'm getting an "Expected Function or Variable" error and RunSQL is highlighted.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,576
Messages
6,179,639
Members
452,935
Latest member
mm1t1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top