Bind a Textbox

  • Thread starter Thread starter JethroUK©
  • Start date Start date
J

JethroUK©

Is it possible to bind a textbox to table that's not bound to the form via
control source e.g.

= [Stats]![from]
 
Not like that. you could create a subform for that one text box. What I
don't see here is how you would relate [Stats]![from] to the current record
in your database. You would have to have a way to do that to get this method
or the next I will describe so you get the correct row in Stats.

Another way would be to treat that one text box as you would if you were
doing an unbound form. You could create a recordset and open it in the
Form's Load event and close it when you close the form. Then you would have
to locate the correct row and display the value in your text box. Then if
you change it, you would have to write code to update the table with the
value in the text box.

Of the two, the subform would probably be the easiest.
 
No. You can only bind to fields that are in the form's recordset, and you
can only put the field's name.
 
JethroUK© said:
Is it possible to bind a textbox to table that's not bound to the form via
control source e.g.

= [Stats]![from]


No, there is not.

Actually, that really doen't make any sense when the table
has multiple records because you can not specify which row
you want to use to get the value of the [from] field.

OTOH, you can easily retrieve the value using a function to
get the value for you. If the table only has one record,
this will work:
=DLookup("[From]", "Stats")

The Domain Aggregate functions also allow you to specify a
where clause to select a particular record from a table with
multiple records.
 
there's only one record - but i tried:

SELECT Top 1 Stats.from FROM Stats;

and it doesn't like that either - not to worry - i was just trying to
establish a simple read/write method


Marshall Barton said:
JethroUK© said:
Is it possible to bind a textbox to table that's not bound to the form via
control source e.g.

= [Stats]![from]


No, there is not.

Actually, that really doen't make any sense when the table
has multiple records because you can not specify which row
you want to use to get the value of the [from] field.

OTOH, you can easily retrieve the value using a function to
get the value for you. If the table only has one record,
this will work:
=DLookup("[From]", "Stats")

The Domain Aggregate functions also allow you to specify a
where clause to select a particular record from a table with
multiple records.
 
shame - thanx


Douglas J Steele said:
No. You can only bind to fields that are in the form's recordset, and you
can only put the field's name.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


JethroUK© said:
Is it possible to bind a textbox to table that's not bound to the form via
control source e.g.

= [Stats]![from]
 
Back
Top