Auto fill second textbox from first textbox

  • Thread starter Thread starter Kerman
  • Start date Start date
K

Kerman

I have two textboxes on my form. I want to enter an account number [AppID]
into the first box, I then want the second box to automatically display the
company name [AppName] associated with the account number. I only want the
[AppID] inserted into my "Account" table. The table with the [AppId] and
[AppName] is "App" Thanks for any help...Randy
 
Kerman,

I think you could use something like this:

In the Control Source of your second text box type:

If the AppID is numeric
=dlookup("[AppName]", "App", "[AppID] = " & me.AppID )

If the AppID is text
=dlookup("[AppName]", "App", "[AppID] = ' " & me.AppID & " ' " )

HTH,
Debbie


|I have two textboxes on my form. I want to enter an account number [AppID]
| into the first box, I then want the second box to automatically display
the
| company name [AppName] associated with the account number. I only want
the
| [AppID] inserted into my "Account" table. The table with the [AppId] and
| [AppName] is "App" Thanks for any help...Randy
|
|
 
I tried your suggestion. I got #Name? in the textbox. I tried several
different variations of your suggestion but couldn't get it to work. Just
for info, the first textbox is named "App_Idlbl", the second is named
"ApplicantName" I dont know if this matters.. Any other
suggestions...Thanks
 
In the Control Source of ApplicantName type:

If the AppID is numeric
=dlookup("[AppName]", "App", "[AppID] = " & me.App_Idlbl )

If the AppID is text
=dlookup("[AppName]", "App", "[AppID] = ' " & me.App_Idlbl & " ' " )

I'm a little confused ... I thought field name was AppID. Why is it called App_Idlbl on your form? That sounds like a label, not a
text box.

You might want to read about DLookUp. The syntax is
=dlookup("[FieldValueYouWantToReturn]", "TableName", "[FieldInTheTable] = " & me.FieldOnFormThatMatchesFieldInTheTable

HTH,
Debbie


|I tried your suggestion. I got #Name? in the textbox. I tried several
| different variations of your suggestion but couldn't get it to work. Just
| for info, the first textbox is named "App_Idlbl", the second is named
| "ApplicantName" I dont know if this matters.. Any other
| suggestions...Thanks
| | > Kerman,
| >
| > I think you could use something like this:
| >
| > In the Control Source of your second text box type:
| >
| > If the AppID is numeric
| > =dlookup("[AppName]", "App", "[AppID] = " & me.AppID )
| >
| > If the AppID is text
| > =dlookup("[AppName]", "App", "[AppID] = ' " & me.AppID & " ' " )
| >
| > HTH,
| > Debbie
| >
| >
| > | > |I have two textboxes on my form. I want to enter an account number
| [AppID]
| > | into the first box, I then want the second box to automatically display
| > the
| > | company name [AppName] associated with the account number. I only want
| > the
| > | [AppID] inserted into my "Account" table. The table with the [AppId]
| and
| > | [AppName] is "App" Thanks for any help...Randy
| > |
| > |
| >
| >
|
|
 
Thanks Ken, that was the solution..Randy
Ken Snell said:
Why not use a combo box to select the account number? That avoids the
problem of people typing in a wrong number. Then you can use the technique
shown on The ACCESS Web to populate the textbox with the "company name":
http://www.mvps.org/access/forms/frm0058.htm


--

Ken Snell
<MS ACCESS MVP>

Kerman said:
I have two textboxes on my form. I want to enter an account number [AppID]
into the first box, I then want the second box to automatically display
the
company name [AppName] associated with the account number. I only want
the
[AppID] inserted into my "Account" table. The table with the [AppId] and
[AppName] is "App" Thanks for any help...Randy
 
Back
Top