Assigning a Value to a Text Box 
Author Message
 Assigning a Value to a Text Box

There appear to be only 2 ways to assign a value to a text box:  1) have the
user type it in or 2) assign it a control source.

Is this true?

What if I have a form that is bound to the Orders table. The Orders table
has a field for customer ID but not for customer name. The customer name is
only in the Customers table.  I want to display the customer name in a text
box on my form based on a customer ID.  How can I do it?

My first thought was to build a query that includes the necessary fields
from both tables.  But then the query only includes customers that have
orders.  I want the text box to display any customer for which a customer ID
is specified regardless of whether this customer currently has any orders.
I suppose I could try a LEFT OUTER JOIN in my query but is there a better
approach?

I guess my basic question is: How can I assign a value to a text box
independent of the record source?



Fri, 13 Jul 2001 03:00:00 GMT  
 Assigning a Value to a Text Box
MyTextBox = StringValue

Quote:

>There appear to be only 2 ways to assign a value to a text box:  1) have
the
>user type it in or 2) assign it a control source.

>Is this true?

>What if I have a form that is bound to the Orders table. The Orders table
>has a field for customer ID but not for customer name. The customer name is
>only in the Customers table.  I want to display the customer name in a text
>box on my form based on a customer ID.  How can I do it?

>My first thought was to build a query that includes the necessary fields
>from both tables.  But then the query only includes customers that have
>orders.  I want the text box to display any customer for which a customer
ID
>is specified regardless of whether this customer currently has any orders.
>I suppose I could try a LEFT OUTER JOIN in my query but is there a better
>approach?

>I guess my basic question is: How can I assign a value to a text box
>independent of the record source?



Fri, 13 Jul 2001 03:00:00 GMT  
 Assigning a Value to a Text Box
My problem is the I want to use the Cust_ID to return the Customer_Name to
the text box.

How do I assign Customer_Name to a text box if the form's record source
contains only a Cust_ID field and not a Customer_Name field?

I can put an expression in a text box using the Expression Builder but the
expression appears limited to VBA.  In other words, it won't accept
something like: SELECT Cust_Name FROM Customers WHERE Cust_ID =
[txtCust_ID].



Fri, 13 Jul 2001 03:00:00 GMT  
 Assigning a Value to a Text Box
I think you could use Dlookup in the text box's control source - something
like =dlookup("[Customer Name]", "Customers", "[Customer ID] = " &
forms!YourFormName![CustomerID].  Take a look at Help on dlookup.
Quote:

> My problem is the I want to use the Cust_ID to return the Customer_Name to
> the text box.

> How do I assign Customer_Name to a text box if the form's record source
> contains only a Cust_ID field and not a Customer_Name field?

> I can put an expression in a text box using the Expression Builder but the
> expression appears limited to VBA.  In other words, it won't accept
> something like: SELECT Cust_Name FROM Customers WHERE Cust_ID =
> [txtCust_ID].



Fri, 13 Jul 2001 03:00:00 GMT  
 Assigning a Value to a Text Box
Why not just include the Customer_Name in the recordsource?  That's
generally pretty straight forward if you base your form on a query.

    - Rebecca


Quote:
>My problem is the I want to use the Cust_ID to return the Customer_Name to
>the text box.

>How do I assign Customer_Name to a text box if the form's record source
>contains only a Cust_ID field and not a Customer_Name field?

>I can put an expression in a text box using the Expression Builder but the
>expression appears limited to VBA.  In other words, it won't accept
>something like: SELECT Cust_Name FROM Customers WHERE Cust_ID =
>[txtCust_ID].



Sat, 14 Jul 2001 03:00:00 GMT  
 Assigning a Value to a Text Box
Thanks Vicky.

That's exactly what I was looking for; kind of a SELECT statement for a text
box.

Dave

Quote:

>I think you could use Dlookup in the text box's control source - something
>like =dlookup("[Customer Name]", "Customers", "[Customer ID] = " &
>forms!YourFormName![CustomerID].  Take a look at Help on dlookup.


>> My problem is the I want to use the Cust_ID to return the Customer_Name
to
>> the text box.

>> How do I assign Customer_Name to a text box if the form's record source
>> contains only a Cust_ID field and not a Customer_Name field?

>> I can put an expression in a text box using the Expression Builder but
the
>> expression appears limited to VBA.  In other words, it won't accept
>> something like: SELECT Cust_Name FROM Customers WHERE Cust_ID =
>> [txtCust_ID].



Sat, 14 Jul 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Assign value to each letter in text box

2. Assigning Multi line text to a multiline text box

3. assign a the text in a text box in an ASP to a VB variable

4. Assigning a value from a list box to a variable

5. Macro to assign value to and sum up check box forms

6. problem assigning value to combox.text in click_event

7. Putting a value from a combo box into a text box on a form

8. Save Text Boxes Values To Combo Box's Item

9. Error 2115 changing text box text / value

10. Q: Assigning Db Vars To Text Boxes Etc Tech Ques

11. Assigning Word Table Cell to VBA text box

12. Q: Assigning Db Vars To Text Boxes Etc Tech Ques

 

 
Powered by phpBB® Forum Software