PC Review


Reply
Thread Tools Rate Thread

Automatically fill a group of text boxes based on another text box

 
 
=?Utf-8?B?U2FyYQ==?=
Guest
Posts: n/a
 
      30th May 2007
Hello,

I need help with a data entry form that should bound to a table called
"Inquiries", I have 4 text boxes on the form, one is a text box where the
user enters the customer ID, then after the user enters the the customer ID
the other 3 boxes automatically should populate with the name, phone number,
and email, this information comes from a "customer" table. What is the best
way to accomplish this?
I appreciate your help
 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      30th May 2007
This is how I would do this. I would add an unbound combo box to my form
with it's row source being the customer table. I would have a column for
each of the 4 fields in the row source, but make all except the customer ID
invisible. Then in the After Update event of the combo, I would assign the
value of each column to the corresponding text box on the form.

Also, I would make the text boxes involved Not enabled and Locked so
incorrect values can't be entered.

This does a couple of things for you. It validates the customer ID you
entered, and make loading the text boxes easier. You can also use the
combo's Not In List event to warn the user of an invalid entry and allow them
to create a new customer record, if necessary.

If you need more detail, please post back

--
Dave Hargis, Microsoft Access MVP


"Sara" wrote:

> Hello,
>
> I need help with a data entry form that should bound to a table called
> "Inquiries", I have 4 text boxes on the form, one is a text box where the
> user enters the customer ID, then after the user enters the the customer ID
> the other 3 boxes automatically should populate with the name, phone number,
> and email, this information comes from a "customer" table. What is the best
> way to accomplish this?
> I appreciate your help

 
Reply With Quote
 
=?Utf-8?B?U2FyYQ==?=
Guest
Posts: n/a
 
      30th May 2007
THANKS, I thought about that but it has to be a text box, there are about
4000 customer ID's and they all start with the same character, so a combo box
would not be helpful as if the user types the 4 character ID. Please HELP!!!

"Sara" wrote:

> Hello,
>
> I need help with a data entry form that should bound to a table called
> "Inquiries", I have 4 text boxes on the form, one is a text box where the
> user enters the customer ID, then after the user enters the the customer ID
> the other 3 boxes automatically should populate with the name, phone number,
> and email, this information comes from a "customer" table. What is the best
> way to accomplish this?
> I appreciate your help

 
Reply With Quote
 
=?Utf-8?B?U2FyYQ==?=
Guest
Posts: n/a
 
      31st May 2007
Thanks, I thought about that but it has to be a text box, there are about
4000 customer ID's and they all start with the same character, so a combo box
would not be helpful as if the user types the 4 character ID. Please HELP!!!


"Sara" wrote:

> Hello,
>
> I need help with a data entry form that should bound to a table called
> "Inquiries", I have 4 text boxes on the form, one is a text box where the
> user enters the customer ID, then after the user enters the the customer ID
> the other 3 boxes automatically should populate with the name, phone number,
> and email, this information comes from a "customer" table. What is the best
> way to accomplish this?
> I appreciate your help

 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      31st May 2007
I disagree with you about whether it should be a combo; however, since you
insist, here is an example of how you would use a text box to look up an
existing customer id. This would be the Before Update event of the text box:

Private Sub txtCustId_BeforeUpdate(Cancel As Integer)
Dim rst As Recordset

Set rst = Me.RecordsetClone
With rst
.FindFirst "[CUST_ID] = '" & Me.txtCustId & "'"
If .NoMatch Then
If MsgBox("Customer " & Me.txtCustID & " not found" & vbNewLine
& _
"Add This Customer", vbQuestion + vbYesNo") = vbNo Then
Cancel = True
Me.Undo
End If
Else
Me.BookMark = .BookMark
End If
End With
End Sub


--
Dave Hargis, Microsoft Access MVP


"Sara" wrote:

> Thanks, I thought about that but it has to be a text box, there are about
> 4000 customer ID's and they all start with the same character, so a combo box
> would not be helpful as if the user types the 4 character ID. Please HELP!!!
>
>
> "Sara" wrote:
>
> > Hello,
> >
> > I need help with a data entry form that should bound to a table called
> > "Inquiries", I have 4 text boxes on the form, one is a text box where the
> > user enters the customer ID, then after the user enters the the customer ID
> > the other 3 boxes automatically should populate with the name, phone number,
> > and email, this information comes from a "customer" table. What is the best
> > way to accomplish this?
> > I appreciate your help

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill text boxes with data from another text box Porkchop Microsoft Access 2 18th Mar 2008 04:51 PM
Data Access Page-Auto fill text boxes based on combo box selection =?Utf-8?B?UmljaGllX0JhdGhvcnk=?= Microsoft Access VBA Modules 0 14th Feb 2007 03:05 PM
Enable/Disable multipule text boxes based on any text in another textbox continued Mesa Microsoft Access Form Coding 6 14th Oct 2006 03:49 PM
Automatically Fill a Text or List Box Based on a Combo Box Selecti =?Utf-8?B?TWF0dA==?= Microsoft Access 3 21st Jun 2006 07:26 PM
fill and text colors change in text boxes when viewed on another p =?Utf-8?B?Sm9lIEtvc3M=?= Microsoft Powerpoint 1 3rd Feb 2006 04:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:13 PM.