Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating a text box on a Form

Status
Not open for further replies.

ASFJEN

Programmer
May 4, 2006
7
US
Okay, so here's my situation, I have created a combo box, where the user selects a client # and then it autopopulates another field. Works great! But now, I have another field that I want to update as well, that is linked to client #. I was trying to do something in the After Update. Here's my code for the first field called Client Name.

SELECT Clients.[Client#], Clients.[Client Name FROM Clients ORDER BY [Client#], [Client Name;

The Control Source for the field Client# is Client Name
Then I have Bound Column 2

My other field that I want to display Payroll Team which is in the Clients table is called Payteam.

Any thoughts or suggestions? Thanks in advance. I have been searching through other threads.
 
RowSource: SELECT [Client#], [Client Name], Payteam FROM Clients ORDER BY 1,2;

AfterUpdate event procedure of the combo:
Me![Payroll Team] = Me![combo name].Column(2)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you for your response. But when I add that to the after Update I get the error message
Microsoft Office can't find the macro 'Me![Payoll Team] = Me!coclient#'

I just don't understand.....
 
I suggested the AfterUpdate event procedure (VBA code)
Choose event procedure and then click the ellipsis (...)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
One more quick question, because I think that will work, however how do I get it to recognize the table name Clients in the After update? Because I don't get the error but nothing happens in the text box named payteam. The field name is Payroll Team. Do I have my syntax wrong...

Private Sub coclient__AfterUpdate()
Me![Payroll Team] = Me![coclient#].Column(2)
End Sub
 
Is the 3rd column of the combo populated ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yes, The combo box currently has this code

SELECT Clients.[Client#], Clients.[Client Name], Clients.[Payroll Team] FROM Clients ORDER BY [Client#], [Client Name], [Payroll Team];

The 3rd column would be Payroll Team
 
text box named payteam
Private Sub coclient__AfterUpdate()
Me![[!]payteam[/!]] = Me![coclient#].Column(2)
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Still not populating anything. I am going to try again tomorrow. Thanks for all your help. I know that there is just something off in what I am doing...
 
I got it to work. Someone before me had set the control source to a different field on the combo box so that's why it wasn't working. Plus, it wasn't populating the underlying data table. But I followed your code and got it to work along with several other fields on the form.

Thank you so much!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top