Off hand, the only thing wrong with your code that I can see is that your
text box name has a space in it. Either rename it to eliminate the space
(best practice) or enclose the name in square brackets (e.g. Me.[Rep Name]).

Also, bear in mind that Access numbers columns from 0 so the first column is
Column(0) and the second is column(1).

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of rokkeee
Sent: Saturday, 24 December 2005 8:03 AM
To: [email protected]
Subject: [ms_access] Re: Populating a Form

Guy,
I saw this and tried to do it with my database form too. It didn't
work. The way I have it setup is to pick a RepId number from a combo
box (named RepId) and have it automatically fill in another field on
the form with the text of the RepName.
Can this code be modified to do that?
Here's a copy of the code that does NOT work for me.
Private Sub Rep_ID_AfterUpdate()
If Nz(Me.Rep_Id, 0) <> 0 Then
Me.Rep Name = Rep_Id.Column(2)
End If

End Sub

Thanks,
Doreen


--- In [email protected], "Guy Harley" <[EMAIL PROTECTED]> wrote:
>
> Very easy to do. Easiest way is to have a combo box (cboEmployee)
with three
> fields - Employee #, name and address. Set the width of the second
and third
> columns to 0 to hide the contents. In the after Update event for the
combo
> box put the following code:
> 
> If Nz(Me.cboEmployee,0) <> 0 Then
>       Me.txtName = cboEmployee.Column(1)
>       Me.txtAddress = cboEmployee.Column(2)
> End If
> 
> Guy Harley



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income homes are not online. Make a difference this holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/q7folB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to