Combo Box to select a record and populate fields in a form

I have created a form where I've created a combo box that has a drop down 
list of box numbers where I want to be able to select one box number and have 
it populate the other fields on the form.

On the combo box, I have entered the following  for "after update", but it 
doesn't allow me to select a record and doesn't populate any of the other 
fields for that record.

Sub Combo74_AfterUpdate()
    ' Find the record that matches the control.
    Me.Filter = "[BoxNo] = """ & Me.Combo74 & """"
    Me.FilterOn = True
End Sub

What am I missing to make this work?
0
Utf
3/29/2010 6:13:02 PM
access.formscoding 7494 articles. 0 followers. Follow

5 Replies
2028 Views

Similar Articles

[PageSpeed] 39

Kathy wrote:

>I have created a form where I've created a combo box that has a drop down 
>list of box numbers where I want to be able to select one box number and have 
>it populate the other fields on the form.
>
>On the combo box, I have entered the following  for "after update", but it 
>doesn't allow me to select a record and doesn't populate any of the other 
>fields for that record.
>
>Sub Combo74_AfterUpdate()
>    ' Find the record that matches the control.
>    Me.Filter = "[BoxNo] = """ & Me.Combo74 & """"
>    Me.FilterOn = True
>End Sub
>

Well, that code should find the desired record as long as
there is one that has its BoxNo Text field that matches the
BoundColumn of the combo box's selected row.  If, as the
name implies, BoxNo is a number type field in its table,
then you should have gotten an error message, in which case
the code should not include the extra quote:
	Me.Filter = "[BoxNo] = " & Me.Combo74

But there is nothing in the code to populate anything.  Are
the text boxes that you want to populate using expressions
like  =Combo74.Column(n)  (the common way to display the
other values) or do you actually want to copy the values to
bound text boxes so thery are saved back to the table
(generally not a good idea).

-- 
Marsh
MVP [MS Access]
0
Marshall
3/29/2010 7:43:22 PM

"Marshall Barton" wrote:

> Kathy wrote:
> 
> >I have created a form where I've created a combo box that has a drop down 
> >list of box numbers where I want to be able to select one box number and have 
> >it populate the other fields on the form.
> >
> >On the combo box, I have entered the following  for "after update", but it 
> >doesn't allow me to select a record and doesn't populate any of the other 
> >fields for that record.
> >
> >Sub Combo74_AfterUpdate()
> >    ' Find the record that matches the control.
> >    Me.Filter = "[BoxNo] = """ & Me.Combo74 & """"
> >    Me.FilterOn = True
> >End Sub
> >
> 
> Well, that code should find the desired record as long as
> there is one that has its BoxNo Text field that matches the
> BoundColumn of the combo box's selected row.  If, as the
> name implies, BoxNo is a number type field in its table,
> then you should have gotten an error message, in which case
> the code should not include the extra quote:
> 	Me.Filter = "[BoxNo] = " & Me.Combo74
> 
> But there is nothing in the code to populate anything.  Are
> the text boxes that you want to populate using expressions
> like  =Combo74.Column(n)  (the common way to display the
> other values) or do you actually want to copy the values to
> bound text boxes so thery are saved back to the table
> (generally not a good idea).
> 
> -- 
> Marsh
> MVP [MS Access]
> .
> When I say I want to popluate the other fields, I just want it to pull up the rest of the fields from the same record as the BoxNo that is selected in the combo box.  I do not want to copy anything.  Are we talking about the same thing?
0
Utf
3/30/2010 5:54:20 PM
Kathy wrote:
>
>"Marshall Barton" wrote:
>
>> Kathy wrote:
>> 
>> >I have created a form where I've created a combo box that has a drop down 
>> >list of box numbers where I want to be able to select one box number and have 
>> >it populate the other fields on the form.
>> >
>> >On the combo box, I have entered the following  for "after update", but it 
>> >doesn't allow me to select a record and doesn't populate any of the other 
>> >fields for that record.
>> >
>> >Sub Combo74_AfterUpdate()
>> >    ' Find the record that matches the control.
>> >    Me.Filter = "[BoxNo] = """ & Me.Combo74 & """"
>> >    Me.FilterOn = True
>> >End Sub
>> >
>> 
>> Well, that code should find the desired record as long as
>> there is one that has its BoxNo Text field that matches the
>> BoundColumn of the combo box's selected row.  If, as the
>> name implies, BoxNo is a number type field in its table,
>> then you should have gotten an error message, in which case
>> the code should not include the extra quote:
>> 	Me.Filter = "[BoxNo] = " & Me.Combo74
>> 
>> But there is nothing in the code to populate anything.  Are
>> the text boxes that you want to populate using expressions
>> like  =Combo74.Column(n)  (the common way to display the
>> other values) or do you actually want to copy the values to
>> bound text boxes so thery are saved back to the table
>> (generally not a good idea).
>> 
>When I say I want to popluate the other fields, I just want
>the BoxNo that is selected in the combo box.  I do not
>want to copy anything.  Are we talking about the same thing?


No, we were talking about two different things.  Displaying
the matching record's fields should be automatic as long as
the controls are bound to fields in the form's record source
table/query.

Did you determine if the type of the BoxNo field is Text or
Number?

Remember that it is common for a combo box to display some
text while it's value is a number used as a foreign key to a
table.  Compare the combo box's BoundColumn and ColumnWidths
properties.  Also check that the field in the combo box's
RowSource table/query corresponds to the field index in the
BoundColumn property.

-- 
Marsh
MVP [MS Access]
0
Marshall
3/30/2010 7:45:17 PM

"Marshall Barton" wrote:

> Kathy wrote:
> >
> >"Marshall Barton" wrote:
> >
> >> Kathy wrote:
> >> 
> >> >I have created a form where I've created a combo box that has a drop down 
> >> >list of box numbers where I want to be able to select one box number and have 
> >> >it populate the other fields on the form.
> >> >
> >> >On the combo box, I have entered the following  for "after update", but it 
> >> >doesn't allow me to select a record and doesn't populate any of the other 
> >> >fields for that record.
> >> >
> >> >Sub Combo74_AfterUpdate()
> >> >    ' Find the record that matches the control.
> >> >    Me.Filter = "[BoxNo] = """ & Me.Combo74 & """"
> >> >    Me.FilterOn = True
> >> >End Sub
> >> >
> >> 
> >> Well, that code should find the desired record as long as
> >> there is one that has its BoxNo Text field that matches the
> >> BoundColumn of the combo box's selected row.  If, as the
> >> name implies, BoxNo is a number type field in its table,
> >> then you should have gotten an error message, in which case
> >> the code should not include the extra quote:
> >> 	Me.Filter = "[BoxNo] = " & Me.Combo74
> >> 
> >> But there is nothing in the code to populate anything.  Are
> >> the text boxes that you want to populate using expressions
> >> like  =Combo74.Column(n)  (the common way to display the
> >> other values) or do you actually want to copy the values to
> >> bound text boxes so thery are saved back to the table
> >> (generally not a good idea).
> >> 
> >When I say I want to popluate the other fields, I just want
> >the BoxNo that is selected in the combo box.  I do not
> >want to copy anything.  Are we talking about the same thing?
> 
> 
> No, we were talking about two different things.  Displaying
> the matching record's fields should be automatic as long as
> the controls are bound to fields in the form's record source
> table/query.
> 
> Did you determine if the type of the BoxNo field is Text or
> Number?
> 
> Remember that it is common for a combo box to display some
> text while it's value is a number used as a foreign key to a
> table.  Compare the combo box's BoundColumn and ColumnWidths
> properties.  Also check that the field in the combo box's
> RowSource table/query corresponds to the field index in the
> BoundColumn property.
> 
> -- 
> Marsh
> MVP [MS Access]
> .
The BoxNo field was a number.  Thanks for all your suggestions.  I was able 
to get the form working.
0
Utf
3/30/2010 9:37:01 PM
high quality Soccer jerseys NBA Jersey tracksuit and jackets, GHD 
hairstraightener supplier from www.willpa.com

Are you a Retail businessman who bother by the purchase price?  China 
Cheapest TOP wholesale website can help you

we are specialize in replica sport goods manufacturing in china, we can 
offer you all kinds of soccer jersey, NBA jersey,shoes and so on. they are 
the best brand replica goods whih are look the same as the original goods. 
excellent quality and steady supply for them. we have been marketed in Europe 
and American for 3 year. all the goods we offer are AAA quality.  our soccer 
jersey are Thailand style. If any goods you buy from my company have problem, 
we will refund or resend them again. Most of ourProducts have no minimum 
order requirements,soyou can shop retail goods at wholesale prices. if you 
can buy more than 300usd. We offer free shipping. The more you buy the more 
discount for you.

National soccer jerseys: http://www.willpa.com
Club soccer jerseys: http://www.willpa.com
NBA Jerseys: http://www.willpa.com
T-shirt and shirt: http://www.willpa.com
Tracksuit: http://www.willpa.com
Hoody & Jackets: http://www.willpa.com
UGG boots: http://www.willpa.com
Hair style: http://www.willpa.com
shopping Index: http://www.willpa.com

EMS shipping.  7days arrive, paypal accept

want more information pls contact us or check our website: www.willpa.com
0
Utf
3/31/2010 8:16:01 PM
Reply:

Similar Artilces:

List box
I am trying to use the list box function from the control toolbar. I am not sure how to get the listings I want in the list box. Is there certain VB coding that is needed? Any help will be appreciated. Thanks. Todd No VBA code needed. In Design mode, click on your list box and select Properties from the Control toolbox (or right-click your list box and select Properties), then scroll down to the ListFillRange Property and indicate the cell range address that has the items you want to appear in the box (i.e., A1:A10). Then exit out of design mode and test your list box. MRO "Tod...

Security in Forms
I have a database into which several people will be able to enter data through a form. What I wish to do is block database members from seeing entries by other database members. Database members do have an id and password to enter the database, but how do I limit their ability to their own entries? I only wish to use the one form - one of the controls does identify the member. Does anyone have some ideas? -- DAM Add to the where clause WHERE ... AND MyCreatedByField=CurrentUser() hth Pieter "Dennis _M" <Dennis_M@discussions.microsoft.com> wrote in message news:9072...

how do i view different mail boxes
I have set up different email accounts in outlook 2000. How do I choose which mail box I view when I go to outlook? btoonhoule <btoonhoule@discussions.microsoft.com> wrote: > I have set up different email accounts in outlook 2000. How do I > choose which mail box I view when I go to outlook? Using IMO or C/W mode? -- Brian Tillman ...

Concatenate Multi-Select List Box Items
I need to use the chosen items in a multi-select List Box as concatenated text in another control on a subform. This text will be part of a large amount of concatenated text. How do I do this? I did find info here about using such items in a query but it was way over my head and I couldn't figure out how to convert that idea to this issue so please don't just refer me to that w/o some other explanation for this novice. For example, if the user selects: Frt Bumper, Grille, & Headlamp in the List Box, I want to then somehow concatenate those selections into a sente...

How do I merge the Next Record in Publisher?
I am trying to create a school directory using our school's Microsoft Publisher 2002. I would like all of the information to be formatted into two columns running down each page. I cannot seem to figure out how to get the <<next record>> function to work. Any assistance is appreciated. Mark Hall wrote: > I am trying to create a school directory using our school's Microsoft > Publisher 2002. I would like all of the information to be formatted into two > columns running down each page. I cannot seem to figure out how to get the > <<next record>>...

Filtering a combo box using a combo box
All, I am trying to filter the records from a table displayed in a combo box using a combo box on the same form. I built a query and set the criteria as Me![FormName]![Combo_box]. This allowed me to filter the list, but it did not do exactly what I wanted. When the first combo box is blank, the second one is also blank. Is there anyway I can get the second combo box to display all of the records when the first box is blank? Thank you for your help. Regards, John Try a criteria in the second combo of: Like Forms!YourFormName!Combo1Name & "*" -- Arvin Meyer, MCP, MVP http:/...

How to prevent list item selection
I'm having one of those blond moments (no offense to any blonds). I have a simple list box to display information. I want to immediately unselect any item that is selected. None of the obvious items I've tried worked. Any suggestions? Set the value to -1 "Robert Flanagan" <nospam@nospam.net> wrote in message news:%23wM31jHeKHA.6096@TK2MSFTNGP02.phx.gbl... > I'm having one of those blond moments (no offense to any blonds). I have > a simple list box to display information. I want to immediately unselect > any item that is sel...

Table in Access Form
Hello, I want to put a table in ACCESS form. And the numbers or the text will be used in querries and coding. How can i do this? Thanks... Regards, Create a form with a datasheet view of your table: 1. Select the table you want to use 2. Use the form wizard to create the Datasheet View. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "SupperDuck" <SupperDuck@discussions.microsoft.com> wrote in message news:02BB96B3-879A-4AB0-9CC4-39173D6C54D0@microsoft.com... > Hello, > > I want to put a table in ACCES...

Adding tabs to a form
Hi all! What happens if I add a lot of new tabs to a form, say the Incident form? Will there be a kind of slide bar or something when I deploy the customization, in order to reach the tabs at the most right? Is there a limit in the number of tabs we can add to a form? Thanks in advance! Mathieu. Mathieu, There is a limit of 8 tabs. During my testing, I did not see a scroll bar for the tabs appear. Looks like you need some brevity with tab names... HTH, Dave ------------------------------------------------- David L. Carr, President Visionary Software Consulting, Inc. Main #: 971-3...

colour change of dated box
How can I change the colour of a dated box of excel after the date is over. I want the programme to read date automatically from pc and change colour. try Conditional Formatting In 2003: 1. Select the cells you want to format 2. Choose Format, Conditional Formatting 3. Choose Cell Value Is from the first drop down 3. Choose Formula is from the first drop down 4. Choose less than 5. In the third box, enter =TODAY() 6. Click the Format button 7. Choose a color on the Patterns tab (or any available option) 7. Click OK twice. -- Hope this is helpful Appreciate that you provide your feedbac...

Field Type Change
I am trying to change a free text field to a drop down menu in my current database, that already has data entered for this particular field, in order to avoid multiple versions of the same organization that are just typed in differently. I'm assuming that I'll need to recode the different versions of an entry to make them uniform but after that, I'm unsure how to proceed so I won't lose any data. Is this possible or will I need to delete the field, recreate it as a drop down and then re-enter the data? Thanks in advance! Mike Thanks everyone for all the input and advice s...

Combo Box on Forms
Hi, I am using a combo box on a form that has several items w/ one being Other. If the user selects other I want them to be able to input what they want so that it will go into the table instead of just the "Other". I just am not really sure on how to do that. Can you help? Thanks, Jaime In design view click on VIEW - Properties and the the combo. Then change Limit To List to No. -- KARL DEWEY Build a little - Test a little "jseger22@yahoo.com" wrote: > Hi, > > I am using a combo box on a form that has several items w/ one being > Other. If the use...

sent box
how do i get the emails in the sent box to show sent to instead of sent from? -- deb deb wrote: > how do i get the emails in the sent box to show sent to instead of sent from? Add/remove whatever columns you want. Right-click on the header row and select Field Chooser. i may have not explained myself too well i dont want to sort by the "to" column i want the header on the email to show "to" not "from" i think the problem might be that this is not the default sent file, its just a folder named "sent" its for my boss, he ha...

Combo Boxes
Someone sent me an Excel document where each of the cells in I1:I312 are combo boxes. When you click off of those cells, the down arrow disappears. The list for the combo boxes are cells AA1 and AB1 (AA1 is New and AB1 is Existing). Please explain how this was done? Also, can you please tell me if it is possible to make New and Existing autocorrect entries. So even though the choices are New and Existing, if you hit N, New appears, and if you hit E, Existing appears. Thanks!! It sounds like Data|Validation. Take a look at Debra Dalgleish's site: http://www.contextures.com/xlDataVa...

Table Design with Many Fields
I am using Access 2007. I have a table ACCOUNTS, with fields for account number, account description, and account balance. There are 12 other fields for various assertions/characteristics related to the accounts. Each account will have at least one of the 12 assertions apply, and many will have more than one. Each characteristic has its own field. I have a form that is used to enter all of the account information including combo boxes to select either high, mod, or low as the value for each of the other 12 fields. Next, I have to determine whether or not each account is sig...

Separator in combo box
hi, Is it possible to have a line separator in a combo box? I mean something like a separator in menus? thanks, Behzad Try :- http://www.codeproject.com/combobox/zsepcmb.asp http://www.codeproject.com/combobox/customcombo.asp -- Regards, Nish [VC++ MVP] http://www.voidnish.com /* MVP tips tricks and essays web site */ http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */ "behzad" <b@b.com> wrote in message news:%23fVB3em5EHA.3368@TK2MSFTNGP10.phx.gbl... > hi, > Is it possible to have a line separator in a combo box? I mean something > like...

Edit box should support languages like japanese,chineese etc
Hi wht im trying to ask is.. 1. In my application, all the labels r in english only. 2.If i change the content of one text box in japanese or chineese language , [Text box value is the title for another dialog] 4.After i changed the content, i want the title to be displayed in japanese or chineese language. Note: I want only that text box to be changed ,,not the entire application.. so How can i able to support multibyte characters in MFC controls CEdit --text boxes.. Plz reply They do. You have to be in a Unicode app, and you have to have selected a Unicode font that has Chin...

Text boxes on graphs
How do you make a text box hide the grid lines behind it on a graph? The grid lines are still visible and run through the text box, cluttering it up. Thanks right-click text box choose -- 'Format Text Box' from shortcut menu colors and lines tab change fill color to white Warm Regards, Crystal remote programming and training Access Basics 8-part free tutorial that covers essentials in Access http://www.AccessMVP.com/strive4peace * (: have an awesome day :) * Drew wrote: > How do you make a text box hide the grid lines behind it on a graph? The > grid line...

Mail Merge Selecting ALL records in Excel instead just rows select
We have had this problem several times and I cannot find a solution. We will open a mail merge Word document that is connected an Excel Workbook. Periodically it will select ALL of the records even though we go through and select just the rows we want. No amount of filtering changes this problem. We have tried re-saving both the word and excel docs, removing the excel doc from the word doc and re-attaching. Help! I'm wondering if you're being misled by the dialog you get when you click Merge to New Document. Even when you have checked off specific records in the ...

Distribution form for Payables could be on main form
When I enter a payable transaction, it would be very handy to have the distribution form at he bottom of the screen just like the Miscellaneous Check in GP 9.0 Instead I need to go to the distribution screen, even if I only want to confirm that the accounts are correct. Many times I also want to put a memo on a distribution line. Along with this it would be handy to be able to set the default as to whether the extra lines on the distribution form are open or closed. I always have to open them to see the account discription and enter a memo. I did put this all on a macro key so I can g...

access compare values and select higher of two
In Access database I want to compare the values in two fields in a form and then select the higher value, insert it into another field and then use in a formula. E.g. Value 1 = 500 Value 2 = 600, 600 to be inserted into another field and then be multiplied. On 11 apr, 21:26, Captain Turtle <Captain Tur...@discussions.microsoft.com> wrote: > In Access database I want to compare the values in two fields in a form a= nd > then select the higher value, insert it into another field and then use i= n a > formula. > > E.g. Value 1 =3D 500 =A0 Value 2 =3D 60...

Multiple Combo Boxes Highlighted
Hi, I have a problem with something in VB6. I have 4 combo boxes with individual names (not an array) located on an SSTab object. When I select another tab and then return to the tab these boxes are located on, each of them appears to be highlighted in blue. I add values to them only when loading the form so I'm at a loss as to why this happens ? Any ideas are greatly appreciated. Thanks, Jen. "Jennifer Ward" <jward@comcast.net> wrote in message news:eq5HrcBrKHA.6064@TK2MSFTNGP02.phx.gbl... > Hi, > > I have a problem with someth...

HELP !! Combo box to feed other combo boxes
Hi, I have a form with a stock list. One field is [Dealer Allocated] so stock can be allocated to a specific dealer - this is a combo box (combo1) for single allocations. I now also want to be able to update this combo box for several records in bulk. I thought I would do this by having a second combo box in the footer of the form which the user selects the dealer from and then clicks a button which looks for first record without dealer allocated and updates the value of combo1 to the value of combo2. This would then be enclosed in a Do Loop for specified number of records. I can...

Edit Field
I often record a macro to repeat often-used keystrokes, but today I found a keystroke that couldn't be recorded. I use Tools, Macros, Record a new Macro and assign it to a toolbar. In my document, I have some cross-references to bookmarks. Some bookmarks begin with a lower-case letter (due to the context in which they are used), but this may be changed in the cross-reference by right-clicking on the field, Edit field, Format - First capital. However, when trying to capture this sequence in a macro recording, the right-click function is not available. Is there an alternative ...

Set Text Box Control To Blank
I have a procedure that executes on the beforeupdate event of a textbox (text24). The procedure works out the checkdigit for the number entered and if there is a discrepancy, a message box appears telling the user the number is wrong. What I'd like to do is modify the code as such so that when a discrepancy is found and the user clicks ok on the message box, focus is returned to (text24) and set to blank so that the faulty number is gone. Here is the code I am using.... It's quite crude as I'm only at beginner level, but hey, it works! Private Sub Text24_BeforeUpdate(Cancel As Int...