If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Point to correct response
I have a combo box on a form called Terminal_Nm. I have labels for Address,
City, St and ZipCode. What I would like to have happen is when I select my Terminal from teh combo box for all of the other info to be populated autmatically in the labels. I am sure there is a question like this somewhere in here and I have seached for a few days looking for something simialr but not luck. Can anyone point me in the right direction or show me a sample of code? Thanks Tony |
#2
|
|||
|
|||
Point to correct response
Here are a couple of examples that should help:
http://www.mvps.org/access/forms/frm0009.htm http://www.mvps.org/access/forms/frm0005.htm -- Wayne Morgan MS Access MVP "Tony" wrote in message ... I have a combo box on a form called Terminal_Nm. I have labels for Address, City, St and ZipCode. What I would like to have happen is when I select my Terminal from teh combo box for all of the other info to be populated autmatically in the labels. I am sure there is a question like this somewhere in here and I have seached for a few days looking for something simialr but not luck. Can anyone point me in the right direction or show me a sample of code? Thanks Tony |
#3
|
|||
|
|||
Point to correct response
I have tried these out and I must be missing something.
My form is called frm_Dest My combobox is called cbTermNm My Lables are lblAdd, lblCt, lblSt, lblZip When I select my Terminal Name from cbTermNm I want the labels to populate the missing info from the table it reside in on the update. For some reason I cannot get them to work. Either Monday is really getting to me already or I just don't get it. Thanks "Wayne Morgan" wrote: Here are a couple of examples that should help: http://www.mvps.org/access/forms/frm0009.htm http://www.mvps.org/access/forms/frm0005.htm -- Wayne Morgan MS Access MVP "Tony" wrote in message ... I have a combo box on a form called Terminal_Nm. I have labels for Address, City, St and ZipCode. What I would like to have happen is when I select my Terminal from teh combo box for all of the other info to be populated autmatically in the labels. I am sure there is a question like this somewhere in here and I have seached for a few days looking for something simialr but not luck. Can anyone point me in the right direction or show me a sample of code? Thanks Tony |
#4
|
|||
|
|||
Point to correct response
First, are these actually labels or textboxes? Assuming labels, see if the
following example helps. In the AfterUpdate event of the combo box: Me.lblAdd.Caption = CStr(DLookup("[FieldName]", "[TableName]", "[FieldName Associated with Combobox]=" & Me.cbTermNm)) Adjust the field name to match the field appropriate for the label being filled. The syntax at the end assumes a number is returned by the combo box, if it is text, adjust the line as follows: Me.lblAdd.Caption = CStr(DLookup("[FieldName]", "[TableName]", "[FieldName Associated with Combobox]='" & Me.cbTermNm & "'")) The newsreader will probably wrap the lines due to their length, it should be one line. If there are apostrophes in the value returned by the combo box, another modification will need to be made, let me know if that is the case. The value of the combo box is the value in the Bound Column of the combo box when you've made a selection. Another option is to add the other items to additional columns in the combo box. You could set the width of those columns to zero to hide them, if you wish. All visible columns will be displayed when the drop down is open, but only the first visible column will be displayed once the selection is made. You could then simple refer to the other columns in the combo box to get the associated values. Example: Me.lblAdd.Caption = Me.cbTermNm.Column(1) The column number above is zero based, so 0 is the first column, 1 is the second, 2 is the third, etc. If the control is a textbox instead of a label, you could set the Control Source of the textbox to point to the appropriate column in the combo box and it will automatically update when the selection is made, no code needed. If you want it to look like a label, you could play with the formatting of the textbox (including the Locked and Enabled properties) to make it look like a label. -- Wayne Morgan MS Access MVP "Tony" wrote in message ... I have tried these out and I must be missing something. My form is called frm_Dest My combobox is called cbTermNm My Lables are lblAdd, lblCt, lblSt, lblZip When I select my Terminal Name from cbTermNm I want the labels to populate the missing info from the table it reside in on the update. For some reason I cannot get them to work. Either Monday is really getting to me already or I just don't get it. Thanks "Wayne Morgan" wrote: Here are a couple of examples that should help: http://www.mvps.org/access/forms/frm0009.htm http://www.mvps.org/access/forms/frm0005.htm -- Wayne Morgan MS Access MVP "Tony" wrote in message ... I have a combo box on a form called Terminal_Nm. I have labels for Address, City, St and ZipCode. What I would like to have happen is when I select my Terminal from teh combo box for all of the other info to be populated autmatically in the labels. I am sure there is a question like this somewhere in here and I have seached for a few days looking for something simialr but not luck. Can anyone point me in the right direction or show me a sample of code? Thanks Tony |
#5
|
|||
|
|||
Point to correct response
Thanks. Just before your response I figured it out. Using on of the samples
you sent. I am just slow today I guess. I Now my issue is I am trying to update the info from lbTermName to a field in a called Orig in a table called Detail. And when I close the form or Move to next record I want the data to popluate. But for some reason I can't get it to follow through. "Wayne Morgan" wrote: First, are these actually labels or textboxes? Assuming labels, see if the following example helps. In the AfterUpdate event of the combo box: Me.lblAdd.Caption = CStr(DLookup("[FieldName]", "[TableName]", "[FieldName Associated with Combobox]=" & Me.cbTermNm)) Adjust the field name to match the field appropriate for the label being filled. The syntax at the end assumes a number is returned by the combo box, if it is text, adjust the line as follows: Me.lblAdd.Caption = CStr(DLookup("[FieldName]", "[TableName]", "[FieldName Associated with Combobox]='" & Me.cbTermNm & "'")) The newsreader will probably wrap the lines due to their length, it should be one line. If there are apostrophes in the value returned by the combo box, another modification will need to be made, let me know if that is the case. The value of the combo box is the value in the Bound Column of the combo box when you've made a selection. Another option is to add the other items to additional columns in the combo box. You could set the width of those columns to zero to hide them, if you wish. All visible columns will be displayed when the drop down is open, but only the first visible column will be displayed once the selection is made. You could then simple refer to the other columns in the combo box to get the associated values. Example: Me.lblAdd.Caption = Me.cbTermNm.Column(1) The column number above is zero based, so 0 is the first column, 1 is the second, 2 is the third, etc. If the control is a textbox instead of a label, you could set the Control Source of the textbox to point to the appropriate column in the combo box and it will automatically update when the selection is made, no code needed. If you want it to look like a label, you could play with the formatting of the textbox (including the Locked and Enabled properties) to make it look like a label. -- Wayne Morgan MS Access MVP "Tony" wrote in message ... I have tried these out and I must be missing something. My form is called frm_Dest My combobox is called cbTermNm My Lables are lblAdd, lblCt, lblSt, lblZip When I select my Terminal Name from cbTermNm I want the labels to populate the missing info from the table it reside in on the update. For some reason I cannot get them to work. Either Monday is really getting to me already or I just don't get it. Thanks "Wayne Morgan" wrote: Here are a couple of examples that should help: http://www.mvps.org/access/forms/frm0009.htm http://www.mvps.org/access/forms/frm0005.htm -- Wayne Morgan MS Access MVP "Tony" wrote in message ... I have a combo box on a form called Terminal_Nm. I have labels for Address, City, St and ZipCode. What I would like to have happen is when I select my Terminal from teh combo box for all of the other info to be populated autmatically in the labels. I am sure there is a question like this somewhere in here and I have seached for a few days looking for something simialr but not luck. Can anyone point me in the right direction or show me a sample of code? Thanks Tony |
#6
|
|||
|
|||
Point to correct response
Again, the question is whether these are labels or textboxes. Also, by your
description, I'm not sure what exactly you're trying to do. Just some general information though. You shouldn't need to keep copies of multiple data from the record you select. For example, you shouldn't need to keep a companies name, address, zip, phone, etc. in a second table. Instead, the table that has this information should have a unique ID field for each record. The only thing you should then need to keep in another table is the value in this unique ID field. You would then link the tables on this common field when you need the other information. The link will cause the tables to "line up" so that you can get the correct information from the original table when for each ID in the 2nd table. -- Wayne Morgan MS Access MVP "Tony" wrote in message ... Thanks. Just before your response I figured it out. Using on of the samples you sent. I am just slow today I guess. I Now my issue is I am trying to update the info from lbTermName to a field in a called Orig in a table called Detail. And when I close the form or Move to next record I want the data to popluate. But for some reason I can't get it to follow through. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to copy or save a photo from a power point presentation | M.A. Rousseau | Powerpoint | 7 | October 18th, 2005 03:26 AM |
Point labels in an Excel scatter plot to be associated text | k_thakur | Charts and Charting | 1 | August 15th, 2005 01:38 AM |
power point response is outline to long to read | judbnk | Powerpoint | 1 | May 23rd, 2005 02:27 AM |
restoring auto correct file back to original word version | Sharon G | General Discussion | 4 | August 8th, 2004 02:37 PM |
separate for point and comma | Frank Dulk | Using Forms | 0 | August 3rd, 2004 02:55 AM |