By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,660 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,660 IT Pros & Developers. It's quick & easy.

Update Textbox with ComboBox Selection lookup value in table

gcoaster
P: 91
Hello!

I have a dilemma


I have a form that is bound to a table = tblCALLDETAILS
I have a field in the table that is on the the form called = email, that is a textbox
txtClientEmail

There is a combobox that has column1 clientFK and column2 FullName

I want to populate the email textbox with email address from tblCLIENTS
and INSERT it. and when CALL is updated, the column is updated and a new record is NOT inserted.

I have tried DLookup , Update, Insert and ... maybe I am not smart enough for access!!!

this code actually works but inserts a NEW RECORD when combobox is updated.

Expand|Select|Wrap|Line Numbers
  1. CurrentDb.Execute "INSERT INTO tblCALLS (clientEmail) Values ('" & Me.cboFullName & "' )"

Any suggestions?
Nov 29 '07 #1
Share this Question
Share on Google+
4 Replies


Rabbit
Expert Mod 10K+
P: 12,324
Hello!

I have a dilemma


I have a form that is bound to a table = tblCALLDETAILS
I have a field in the table that is on the the form called = email, that is a textbox
txtClientEmail

There is a combobox that has column1 clientFK and column2 FullName

I want to populate the email textbox with email address from tblCLIENTS
and INSERT it. and when CALL is updated, the column is updated and a new record is NOT inserted.

I have tried DLookup , Update, Insert and ... maybe I am not smart enough for access!!!

this code actually works but inserts a NEW RECORD when combobox is updated.

Expand|Select|Wrap|Line Numbers
  1. CurrentDb.Execute "INSERT INTO tblCALLS (clientEmail) Values ('" & Me.cboFullName & "' )"

Any suggestions?
1) I want to populate the email textbox with email address from tblCLIENTS
and INSERT it.

When and how often do you want to do this?

2) and when CALL is updated, the column is updated and a new record is NOT inserted.

I have no idea what CALL is, you have not told us.
Dec 10 '07 #2

gcoaster
P: 91
Hello Rabbit!

here was the solution to my problem

This code is getting email address from combobox in column 3 and populating
field on form named clientEmail.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboFullName_AfterUpdate()
  2. Me.clientEmail = Me.cboFullName.Column(2)
  3. End Sub
  4.  
I have learned you can bring in more then 2 values using wizard for combobox on a main form and then use those values from it to populate textboxes on forms etc one of the many tricks i have learned on here.

thank you very much and may the Lord bless you this Christmas
gcoaster
Dec 13 '07 #3

Rabbit
Expert Mod 10K+
P: 12,324
Good luck.
Dec 13 '07 #4

P: 3
Thanks for that.

Wow I looked and looked. And when you posted that I said to myself DUH....

Thanks
Mar 20 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.