Auto Populate text box based on combo box

Hello,

I have a combobox named "Bulk" and a text box named "Routing", I would like 
the Routing box to auto populate after the user selects an option from 
"Bulk". The Bulk combo box is bound to a table named "Products and bulks". 
The Routing selection would be coming from the same table. 

Could someone please explain this to me? I have tried different codes like:

Private Sub cboPersonID_AfterUpdate()
     Me.txtPersonName.Value = Me.cboPersonID.Column(1)
End Sub

Everytime I put this in the Combo Box's afterupdate property, an error 
message comes up saying it can't find the me.______

Thanks,



0
Utf
10/11/2007 7:21:00 PM
access 16762 articles. 3 followers. Follow

4 Replies
1319 Views

Similar Articles

[PageSpeed] 35

On Oct 11, 1:21 pm, Emily <Em...@discussions.microsoft.com> wrote:
> Hello,
>
> I have a combobox named "Bulk" and a text box named "Routing", I would like
> the Routing box to auto populate after the user selects an option from
> "Bulk". The Bulk combo box is bound to a table named "Products and bulks".
> The Routing selection would be coming from the same table.
>
> Could someone please explain this to me? I have tried different codes like:
>
> Private Sub cboPersonID_AfterUpdate()
>      Me.txtPersonName.Value = Me.cboPersonID.Column(1)
> End Sub
>
> Everytime I put this in the Combo Box's afterupdate property, an error
> message comes up saying it can't find the me.______
>
> Thanks,

You are on the right track, but here are a couple of observations.

You said that your combo box is named "Bulk" and your text box is
named "Routing". However, your event code refers to a text box named
"txtPersonName" and a combo box named "cboPersonID", so you need to
verify the actual names of your controls and use those names in your
code.

Also, if you're going to use the Column property, you need to make
sure that the query that is used as the row source of your combo box
contains the "Routing" field from the table. Also verify that this
field is the second column in the query. It is a zero based numbering
system, so Column(0) is the first column, Column(1) is the second
column, etc.

HTH

0
Beetle
10/11/2007 8:06:55 PM
Thanks for the response. 

I was aware that I would need to change the control names, that was an 
example. Thanks for the advice though.

On the second point, I am following all of the instructions listed, but it 
still will not work.

Here is what I have in the row source property of the Bulk Combo Box:

SELECT [Product and Bulks].Bulk, [Product and Bulks].Routing FROM [Product 
and Bulks] ORDER BY [Product and Bulks].Bulk, [Product and Bulks].Routing; 

Bulk is the first column in the query and routing is the second.

Do you have any other ideas as to what is wrong?

Thanks,
Emily

"Beetle" wrote:

> On Oct 11, 1:21 pm, Emily <Em...@discussions.microsoft.com> wrote:
> > Hello,
> >
> > I have a combobox named "Bulk" and a text box named "Routing", I would like
> > the Routing box to auto populate after the user selects an option from
> > "Bulk". The Bulk combo box is bound to a table named "Products and bulks".
> > The Routing selection would be coming from the same table.
> >
> > Could someone please explain this to me? I have tried different codes like:
> >
> > Private Sub cboPersonID_AfterUpdate()
> >      Me.txtPersonName.Value = Me.cboPersonID.Column(1)
> > End Sub
> >
> > Everytime I put this in the Combo Box's afterupdate property, an error
> > message comes up saying it can't find the me.______
> >
> > Thanks,
> 
> You are on the right track, but here are a couple of observations.
> 
> You said that your combo box is named "Bulk" and your text box is
> named "Routing". However, your event code refers to a text box named
> "txtPersonName" and a combo box named "cboPersonID", so you need to
> verify the actual names of your controls and use those names in your
> code.
> 
> Also, if you're going to use the Column property, you need to make
> sure that the query that is used as the row source of your combo box
> contains the "Routing" field from the table. Also verify that this
> field is the second column in the query. It is a zero based numbering
> system, so Column(0) is the first column, Column(1) is the second
> column, etc.
> 
> HTH
> 
> 
0
Utf
10/11/2007 8:28:01 PM
On Oct 11, 2:34 pm, Emily <Em...@discussions.microsoft.com> wrote:
> Also, what does the column property do? I am not sure I need to use it. I
> just want the simplest way to make my form work.
>
> Thanks.
>
>
>
> "Beetle" wrote:
> > On Oct 11, 1:21 pm, Emily <Em...@discussions.microsoft.com> wrote:
> > > Hello,
>
> > > I have a combobox named "Bulk" and a text box named "Routing", I would like
> > > the Routing box to auto populate after the user selects an option from
> > > "Bulk". The Bulk combo box is bound to a table named "Products and bulks".
> > > The Routing selection would be coming from the same table.
>
> > > Could someone please explain this to me? I have tried different codes like:
>
> > > Private Sub cboPersonID_AfterUpdate()
> > >      Me.txtPersonName.Value = Me.cboPersonID.Column(1)
> > > End Sub
>
> > > Everytime I put this in the Combo Box's afterupdate property, an error
> > > message comes up saying it can't find the me.______
>
> > > Thanks,
>
> > You are on the right track, but here are a couple of observations.
>
> > You said that your combo box is named "Bulk" and your text box is
> > named "Routing". However, your event code refers to a text box named
> > "txtPersonName" and a combo box named "cboPersonID", so you need to
> > verify the actual names of your controls and use those names in your
> > code.
>
> > Also, if you're going to use the Column property, you need to make
> > sure that the query that is used as the row source of your combo box
> > contains the "Routing" field from the table. Also verify that this
> > field is the second column in the query. It is a zero based numbering
> > system, so Column(0) is the first column, Column(1) is the second
> > column, etc.
>
> > HTH- Hide quoted text -
>
> - Show quoted text -

The column property lets you refer to a field value in the query, even
if that field is not displayed in your combo box.

Your row source query looks fine, so I don't think that is the
problem. One thing about using this method is that the rtext box need
to be unbound (not bound directly to a table or query field), so you
might check the properties of your text box and make sure there is
nothing in it's "Control Source" property.

0
Beetle
10/11/2007 9:16:58 PM
Sorry I'm just geting back to you, lost track of this thread for a bit but 
hopefully you're still checking it. I see your problem, at least if I'm 
reading your post correctly. You don't  type your code directly into the row 
source of your combo box. That is where the SQL statement goes (SELECT 
[Products and Bulk].[Bulk]...etc.)

Go to the event tab on the properties sheet for your combo box. Go to the 
AfterUpdate event line and click the elipse to the right of it, then choose 
code builder. This will open the Visual Basic screen. The following line of 
code should already be there;

Private Sub cboBulk_AfterUpdate

You will just need to add;

Me.txtRouting = Me.cboBulk.Column(1) 

or whichever column number you need.

you can put txtRouting.Value if you want, but you don't need to because 
..Value is the default so it doesn't need to be declared explicitly

If I misunderstood you reply let me know, I'm just going off your statement

 "I am just putting the below text  into the combobox Bulk's row source. 
Then it should work properly, right?"

HTH

-- 
_________

Sean Bailey


"Emily" wrote:

> Thanks for the info. 
> 
> I changed the routing text box to be unbound, but the query still will not 
> work. Is there a step that was left out? I am just putting the below text 
> into the combobox Bulk's row source. Then it should work properly, right?
> 
> Private Sub cboBulk_AfterUpdate()
> Me.txtRouting.Value = Me.cboBulk.Column(1)
> End Sub
> 
> 
> The error message is that the macro doesn't exist. Do I need to create a 
> macro- if so how? 
> 
> I have checked the columns on my query in the combobox's row source property 
> and they are in the order of: Bulk = the first column and Routing is second.
> 
> I don't know what else I can do to make this work!
> 
> Best regards,
> Emily
> 
> > The column property lets you refer to a field value in the query, even
> > if that field is not displayed in your combo box.
> > 
> > Your row source query looks fine, so I don't think that is the
> > problem. One thing about using this method is that the rtext box need
> > to be unbound (not bound directly to a table or query field), so you
> > might check the properties of your text box and make sure there is
> > nothing in it's "Control Source" property.
> > 
> > 
0
Utf
10/14/2007 2:58:01 AM
Reply:

Similar Artilces:

Writing to web-based database
I am trying to build VBA code that will write to a database locatedona web server. Database is MS Access now, but could use SQL Server orsomething else SQL based. How can I automate the process of opening,appending, and closing a database when the Office application is onthe local computer but the database is on a web server?...

faq: How to obtain the select plain text?
Hi, Just like the notepade.exe in windows, I type some plain text and select it using mouse with left button pressed, and copy it to the clipboard by select copy command in the menu Edit. How to do that? Thanks very much. http://msdn2.microsoft.com/en-us/library/80db3kax(VS.80).aspx http://www.codeproject.com/editctrl/editctrltutorial.asp Also, take a look at CEdit::Copy() CEdit::Paste() CEdit::Cut(). They should do what you'd like. http://msdn2.microsoft.com/en-us/library/75bh1f1t(VS.80).aspx Tom "fcvcnet" <fcvcnet@163.com> wrote in message news:fhb5as$ghh$1@ne...

Auto Update Problem
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I have been trying to update my Office 2008 Student and Home edition. I have tried within the different softwares and by manually downloading the updates. I currently have version 12.0. The updates download properly, then I start the installation process. I get the following: Installing Office SP1 Update Running Auto Update Installer Script No matter how long I leave the computer - it never moves beyond 1 bar - the longest I left it was 5 hours. I have 3 updates I have to do 12.1, 12.11 and 12.12. Can you please ass...

auto-signature changes format on reply
What causes an autosignature to change format on replies? I have one user who is using Outlook 2000. When he replies to email, his auto-signature changes from single spacing to double spacing and loses some of its formatting. I tried creating a new auto-signature using word as his email editor, but the signature still changes on replies. Any suggestions or fixes? Thanks! Joann ...

check boxes
I would like to copy (hundreds) of check boxes in a spreadsheet. The checkbox must be assigned to a cell to work in a formula. When I copy the checkbox down however, all check boxes will either be checked, or unchecked. Is there a way to copy check boxes, when they are assigned to another cell, so that each check box can be used individually? I created the check boxes through the forms toolbar. Thanks for your help, this is a great forum and I only hope to give some day as much help as I am currently receiving! Hey, Mark- Things got busy yesterday, and I missed your post. You can t...

Requery a Combo Box List
I have a combo box in a Tabular Form which has a drop down box select, but if I put the word Green in the list , the option to select it in the next box doesn't show untill I close the form and open it again is there a way to update it straight away........Thanx ....Bob Use code like the following in the AfterUpdate event of the combo: Private Sub MyCombo_AfterUpdate() Me.NameOfComboToRequery.Requery End Sub -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "Bob" <xxx@xx.xx> wrote in message news:evmhs8$d3q...

Reverse Cascading Combo Box's ??
So i've got the whole cascading combo box process down to a T, but now I would like to get a little more sophisticated with it. I have a form with 2 combo box's on it: cboParentName and cboChildName. The combos are set up where they receive parameters from other forms or can be selected by using the drop down menu. That process works. The trick would be when cboChildName receives the parameter from the a different form, it would "auto select" cboParentName with the correct name. Thus limiting cboChildName to the proper list. cboParentName already has the code: cb...

Query based Subform will not allow editing
I have a maintenance DB that has energy lockout points associated with pieces of equipment so we can safely do maintenance. I have an 'edit existing lockout' form, based on a query, that lists in a subform the various points required for a certain piece of equipment. My system used to work, but now I can edit the main, but the subform has locked me out. All I get is a doorbell tone when I attempt to enter info. I can enter the req'd info in the tables, but but my form went snafu. Any ideas? Thanks in advance Does your query allow editing? Check the asterisk in the record...

Auto-adjust column width
Hi all Is there a way to set a column width so that it auto-adjusts to the widest entry in the column? And what about the widest numerical entry, excluding word-wrapped cells containing text? I realise that I can double-click on the edge of the column header to achieve most of the desired result passively, but this does not work if the worksheet is protected. Thanks -- Return email address is not as DEEP as it appears Hi depending on your Excel version you can allow formating columns in the protection dialog. (I think starting with Excel 2002). In all other cases no chance but to remo...

How to get one field to update based on a selection from a drop do
New to Access. I want to create a form that coworkers can use to lookup information in a database for inputting data into a PO as well as submit new records into the database. I want to have a control that is a combo drop down box where the can select a row from a list of items in a specified field and based on that selection it will update the below text box control with the corresponding data in the field next to it on the database. Make sense? Basically need to figure out how to update one control based on data selected from the drop down box control above it??? Private Sub...

Merging Workbook Table data Based upon Value comparisons
I have two workbook tables (Two different workbooks) with two matching column names. What I wish to do is to merge values from one table to another, but ONLY for those records inwhich these two columns have matching values. Would this be possible? Jay Are you saying you have two workbooks, or are the tables within one workbook? "jayceejay" <jayceejay@discussions.microsoft.com> wrote in message news:AC73B2C7-83EF-4D27-A464-32AEEE7D4214@microsoft.com... >I have two workbook tables (Two different workbooks) with two matching >column > names. What I wish to do ...

Format in an unbound Text Box
Hi all, I have a form that I have put an unbound text box in, which displays the previous entries from my table. One of my fields is Current Time. Which on my form I set to Short Date (military time). How can I have my unbound text display Short time as well. here is my code (control source of my unbound text box). SELECT DISTINCTROW tblSITLog.[current time], tblSITLog.MONTH, tblSITLog.DAY, tblSITLog.SIT, tblSITLog.[NATURE OF iNCIDENT], tblSITLog.[Case Description], tblSITLog.Incident_Number FROM tblSITLog WHERE (((tblSITLog.[NATURE OF iNCIDENT])="CHRONO ENTRY")) ORDER BY...

want a,j&s to =1 when i type a letter in a box
I would like to make a chart when i type a letter in a box like A,J,S would = 1 and BK&t would = 2 and so on If you provide more information, someone may be able to help you. Is the box on a UserForm, or on a worksheet? One box, or several? What kind of chart do you want to make? scottalockhart wrote: > I would like to make a chart when i type a letter in a box like A,J,S would > = 1 and BK&t would = 2 and so on -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

Curve the Text Box in a Newsletter?
Is there a way to curve the text box justification? There are severa templates within Publisher that have curved color "blocks" that ru along the left or right border of the newsletter. I am able t insert a text box, but am unable to justify it along the curve of th color block Any ideas would be greatly appreciated Thanks. Lewiedude This is a wrap issue, bring the "color blocks" to the front. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "lewiedude" <mlewensohn@comcast-dot-net.no-spam.invalid&g...

Auto-refresh Pivot Table upon opening
Over the past couple of days, I have been asking questions about a macro that auto-refreshes a pivot table upon opening it (meanwhile I have a macro that works). Yesterday I noticed that the Pivot Table options (Excel 2002) provides an option "refresh on open." Does selecting this option do exactly what I was looking for? Yes, the "Refresh on open" setting will do what you want, unless the worksheet is protected. If it is protected, you can run a macro when the workbook opens, to unprotect, refresh, and protect. K. Georgiadis wrote: > Over the past couple of da...

how to converts a number to text eg. "2" become "two" #2
http://support.microsoft.com/default.aspx?scid=kb;en-us;213360 many excel utilities from third parties have this built in http://xcell05.free.fr/ Morefunc for instance, see above link -- Regards, Peo Sjoblom Northwest Excel Solutions Portland, Oregon "CQ" <CQ@discussions.microsoft.com> wrote in message news:03EC3E12-2919-4F4F-9D6B-101F7C095860@microsoft.com... > ...

Microsoft Knowledge Base Article
I am getting an error with Outlook - "Some items could not be deleted. They were either moved or already deleted, or access was denied." I found the error in the MS Knowledge base with one difference. The article refers to the error occuring after deleted 5000+ items, however this error is happening when the user tries to delete 10 or so e-mails. He does not get the error everytime he deletes items. Any ideas anyone? Are you using exchange server and does it have AV running on it? Can you delete them if you use shift+delete? if so, known issue. -- Diane Poremsky [MVP - O...

Total a column from sheet 2 based on value in sheet 1
Col B Col C Col F Mary Team 1 $331.00 George Team 1 $222.00 Sam Team 2 $186.00 Tom Team 2 $100.00 Above is an example of my data on Sheet 2. On Sheet 1, I want to total all the total funds raised per Team shown on Sheet 2. I am trying to create a summary of what each team raised. I tried using the formula: =SUM(('sheet 2'!F2:F482=Sheet1!B2)) and I get just a dash in my total col. Can anyone provide some help? Thanks Look in HELP for the SUMIF() function -- Kind regards, Niek Otten Microsoft MVP - Excel "Nee...

Option Box radio button wont select
I'm must be missing something very simple but... I have an option box in the footer of a continous form. I'll use the option box to set the filter property on the continous form. The problem is the first radio buttton in the group is selected when the form opens and I'm not able to select any of the options. The option group is unbound, nothing in the Control source. Also if I remove the default value of 1 I am not able to select any radio buttons in the group. Thanks, Rick I would create a second option group next to the 1st, make it just basic, ie don't go to fancy ...

HOW DO i SET DEFAULT TEXT BOXES IN PUBLISHER
I have found MVP who created the toolbar for this, but the page will not allow me to download the toolbar. Any suggestions?? What is the URL? I can't remember a toolbar. When you are finished modifying the normal.pub and you save as: C:\Documents and Settings\User Name\Application Data\Microsoft\Office\normal.pub, in the save as dialogue, click tools on the right top, click add to "My Places." It will quickly be available. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com http://officebeta.iponet.net/en-us/publisher/F...

Auto Post GL and AR batch
Hi, Can we set the auto post GL and AR batch ? Through macro I can set the auto post batch but for some reason if that batch is not available than Great Plains post the next available batch. Thanks, You are experiencing this problem, because you are using your mouse to select the batch. When doing that, GP records the batch list position. If the batch you wanted was in position 3, but no longer exists, whatever batch is in position 3 will be used. In order to avoid this, don't lookup the batch name. Instead, type it in. One other thing, though, is that if the batch that is ...

Use of check boxes in a database
Hi I'm hoping for some help in this. I have included the use of checkboxes in my database. So basically, if it's checked, it means yes. If not, it means no. The people who are using this database would like me to include the word yes or no adjacent to the checkboxes. I believe this is redundant but they're insistent on the inclusion. What do you think is the best way to deal with this question? Thank you in advance for your help. On Mon, 8 Mar 2010 21:03:01 -0800, forest8 <forest8@discussions.microsoft.com> wrote: >Hi > >I'm ho...

eXceL 2003
I'm trying to incorporate either a list box or a combo box into a spreadsheet. (My source is How to Programmatically Insert Data from a List Box into the Active Cell at http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3BQ213363 ) One of the instructions is to right click on the list box and go to the Format Control menu. The problem I have at this point is that there is no "Control" tab in the dialog box. Is that because the instructions are for Excel 2000 and I'm working in Excel 2003 where the control is no longer handled the same way? Are you using the lis...

wrapping and auto row height
I am wrapping text in a cell, not huge amounts, but a few lines, and when I double click to get the row automatically height adjusted, it doesn't expand to the height of the multiple rows, but only to one row of text. Is there a better way to do this? Jessica Is the "cell" a merged cell? Wrap text works on merged cells. Autoheight does not. Perhaps this is what you are experiencing. You can resize manually or via Macro. Jim Rech has written code for this. http://groups.google.com/groups?threadm=e1%241uzL1BHA.1784%40tkmsftngp05 Note also a recent adaptation of this code b...

Ignoring blank cells in a combo box...
Is there any way I can ignore blank cells when using a combo box fro the forms menu? For instance, my combo box is being filled by th range A1:A5. However, if A3 is blank, I don't want it ( a blank) t show up in the drop down box. Is there is a more efficient way to d this or it might it be more simple to use a combo box from the contro toolbox? Any help would be appreciated. Thanks -- Message posted from http://www.ExcelForum.com The combobox from the Forms toolbar is also called a DropDown. And you could use a little code that filled up that dropdown: I chose to put it into the...