PC Review


Reply
Thread Tools Rate Thread

2 Related field or Auto fill up 2nd field after 1st field entered

 
 
=?Utf-8?B?S2FvbGk=?=
Guest
Posts: n/a
 
      17th Sep 2006
I have 2 related field in a transaction table
Example "Taxi Number" (1st Field) "Taxi Driver" (2nd Field)
Let say i have a table having latest or default Driver driving which taxi
record as per below

TaxiNumber TaxiDriver
New York 1111 Micheal
New York 2222 Jodan
.....

Now if i entred New York 1111 into "Taxi Number" (1st Field) in the
transaction table can "Taxi Driver" (2nd Field) auto filling with Micheal
into the field? but i still able to change "Taxi Driver" (2nd Field) as Jadan
or other driver because maybe today he taking leave and replace by other
driver.

TaxiNumber TaxiDriver
New York 1111 (after entered) Micheal (auto filled but still able
to change to other
driver)
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      17th Sep 2006
How are you entering the taxi number?

If you're using a combo box (which would be the preferred approach), make
sure that the combo box also contains the driver name, even if it isn't
displayed. In the AfterUpdate event of the combo box, put code like:

Private Sub cboTaxiNumber_AfterUpdate()
Me.txtTaxiDriver = Me.cboTaxiNumber.Column(1)
End Sub

This assumes that the driver name is the 2nd column in the combo box (the
Column collection starts numbering at 0)

If you're using a text box, you'll need to do a look-up in the AfterUpdate
event. You should be able to use something like:

Private Sub txtTaxiNumber_AfterUpdate
Me.txtTaxiDrive = DLookup("[TaxiDriver]", "[Drivers]", "[TaxiNumber] = '"
& Me.txtTaxiNumber & "'")
End Sub

cboTaxiNumber is supposed to be the name of the combo box being used if
that's the route you're going while txtTaxiNumber would be the name of the
text box you key the taxi number into if using that route. txtTaxiDriver is
the text box to hold the driver name. I've assumed that the data is stored
in a table named Drivers, and that the relevant fields in that table are
TaxiNumber and TaxiDriver. Replace those names with whatever your actual
names are.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Kaoli" <Kaoli @discussions.microsoft.com> wrote in message
news:(E-Mail Removed)...
>I have 2 related field in a transaction table
> Example "Taxi Number" (1st Field) "Taxi Driver" (2nd Field)
> Let say i have a table having latest or default Driver driving which taxi
> record as per below
>
> TaxiNumber TaxiDriver
> New York 1111 Micheal
> New York 2222 Jodan
> ....
>
> Now if i entred New York 1111 into "Taxi Number" (1st Field) in the
> transaction table can "Taxi Driver" (2nd Field) auto filling with Micheal
> into the field? but i still able to change "Taxi Driver" (2nd Field) as
> Jadan
> or other driver because maybe today he taking leave and replace by other
> driver.
>
> TaxiNumber TaxiDriver
> New York 1111 (after entered) Micheal (auto filled but still
> able
> to change to
> other
> driver)



 
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
1st Wed, 1st Sat, 1st Sun Keyrookie Microsoft Excel Worksheet Functions 5 15th Feb 2010 09:58 AM
When opening a form have a field fill in on 2nd form based on 1st =?Utf-8?B?TGVzbGll?= Microsoft Access 0 10th Sep 2007 03:22 PM
How to forward 1st email to him, 2nd email to her, 1st email to him, etc. mensan@hotmail.com Microsoft Outlook Discussion 3 30th Jan 2007 09:40 PM
Outlook: allow appts for 1st/2nd (some)day after 1st Sun/or/date =?Utf-8?B?eXVyIGJydXRoYQ==?= Microsoft Outlook Calendar 0 1st Oct 2005 07:36 PM
print 1st page each section in form ltr to 1st tray, 2nd to 2nd tr =?Utf-8?B?dGhla2Vs?= Microsoft Word Document Management 1 11th May 2005 03:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:28 PM.