473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem populating combo box

122 100+
I'm trying to populate a combo box on a form by inserting this query:

Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM menu
  3. WHERE NOT submitted;
  4.  
into the Row Source property of the combo box control. The Row Source Type is set to Table/Query. The query is a stand alone query (not just typed into the Row Source property).

Every time I try to save the form or switch to form view, I get the error message: Microsoft Access has encountered a problem and needs to close.

Here is what I've tried so far:
  • recreated the combo box
  • rewritten the query
  • compacted and repaired the database
  • created a new database and imported all my tables, form, reports, queries, macros, and modules

I don't know what else to try. Can you help me or is there any more information I can provide to help you to help me solve this problem?
Jul 2 '08 #1
8 1780
Actually your process is correct. Better u try to create one query with ur sql select statement. And test the query. If its correct better u give that query name as a recordsource of the combo box.

Regards
Salim
Jul 3 '08 #2
NeoPa
32,556 Expert Mod 16PB
What happens if you try to save the form without the ComboBox there (deleted)?
(Don't forget to backup anything you change for testing purposes.)
Jul 3 '08 #3
Annalyzer
122 100+
The query does return the correct records, salimudheen, and it is saved as a separate query with the name of the query as the record source for the combo box.

NeoPa, I can save the form with the combo box deleted just fine. I can also save the form with the combo box in place as long as I don't try to add the query as the record source. It's only when I put that query in place that I have problems. Does it matter that the form itself will change the results of the query? The purpose of the form is to add new menus to the database. Later in the processing, a group of menus are submitted as a single claim. Hence, the menus being entered on the form fit the criteria of the query. The purpose of the combo box is to allow the user to retrieve and change a menu that has already been entered but has not yet been submitted in a claim. If this is the problem, I wonder if I could put the combo box in a subform? I guess that will be the next thing I try unless you see a more definite problem and/or solution.
Jul 3 '08 #4
Annalyzer
122 100+
I finally figured this one out. Apparently, you can't have calculated fields in the query that populates the combo box. As soon as I took the calculated fields out, the combo box populated correctly with no errors.
Jul 5 '08 #5
Stewart Ross
2,545 Expert Mod 2GB
Hi Annalyser. I've been following this puzzle too, and though I'm glad you have found a solution things don't quite add up. In particular, your reference to calculated fields is in conflict with your SQL posted in post #1 which is a straightforward select all from an underlying table.

I had tried, as I am sure had others, to replicate the problem you faced - without success. My conclusion was that there had to be more to this one than what you mentioned in your posts (by oversight I am sure).

Access combos can normally be used with calculated fields in their rowsource queries (e.g. to show an item list with Max(SalesDate) to show the most recently recorded transaction for that item). I cannot think what must have been happening to cause the application errors that shut you down so consistently. When I was trying to replicate the problem earlier I had the nagging feeling that what you were doing with the combo was in conflict with the form's recordsource in some way, but that was just conjecture on my part.

I went as far as trying deliberately to set a recordsource for the combo that was the same as the recordsource of the form itself - no problems there. Anyhow, you found a solution that worked, and that can only be to the good for you.

-Stewart
Jul 5 '08 #6
Annalyzer
122 100+
You are so right and I am so undisciplined. The query was pulling * from a query, not from a table (my bad, I'm sorry to mislead). The query it was pulling from was this:

Expand|Select|Wrap|Line Numbers
  1. SELECT menu.provider, menu.month, menu.year, menu.type, menu.t1attend, menu.t2hattend, menu.t2lattend, menu.op_days, menu.t1B, menu.t1AS, menu.t1L, menu.t1PS, menu.t1S, menu.t1ES, menu.t2hB, menu.t2hAS, menu.t2hL, menu.t2hPS, menu.t2hS, menu.t2hES, menu.t2lB, menu.t2lAS, menu.t2lL, menu.t2lPS, menu.t2lS, menu.t2lES, menu.t1Bprice, menu.t1ASprice, menu.t1Lprice, menu.t1PSprice, menu.t1Sprice, menu.t1ESprice, menu.t2lBprice, menu.t2lASprice, menu.t2lLprice, menu.t2lPSprice, menu.t2lSprice, menu.t2lESprice, provider.lname & ", " & provider.fname AS Name, (t1B*t1Bprice)+(t1AS*t1ASprice)+(t1L*t1Lprice)+(t1PS*t1PSprice)+(t1S*t1Sprice)+(t1ES*t1ESprice)+(t2hB*t1Bprice)+(t2hAS*t1ASprice)+(t2hL*t1Lprice)+(t2hPS*t1PSprice)+(t2hS*t1Sprice)+(t2hES*t1ESprice)+(t2lB*t2lBprice)+(t2lAS*t2lASprice)+(t2lL*t2lLprice)+(t2lPS*t2lPSprice)+(t2lS*t2lSprice)+(t2lES*t2lESprice) AS [Claim Total]
  2. FROM menu, provider
  3. WHERE menu.provider=provider.Id AND menu.selected=True;

The form's recordsource is the table 'menu.' I had the same feeling about there being a conflict, but I couldn't make sense of it.

It's kind of weird, really, my not being able to think straight. Been lots of stress the past few months - husband's aorta split, life flight to hospital, 8 hours open heart surgery, 2 weeks in a coma, etc, etc. This was all 5 months ago and I thought it was over. I didn't realize how much it had affected me until I started this project. I'm having a hard time following a train of thought like I used to. Sure hope it gets better, this is frustrating. Thanks for your help. You've been a real blessing.
Jul 6 '08 #7
Stewart Ross
2,545 Expert Mod 2GB
Hi Annalyser. I think you have had much more pressing matters to deal with than Access in the last few months! I wish you and your husband well and hope that the traumatic events you have experienced have been, and continue to be, overcome.

Looking at the query you provided, I notice that your two tables (menu and provider) are unjoined. Although the Where clause will do a similar job to the join, we do not know and cannot predict the workings of the Access Database engine (JET). Depending on the size of the tables the lack of a join could be a source of difficulty, but I doubt that it could explain the severe errors causing application closedown.

There are several calculated fields in the query, but on the face of it these are not complex either.

This one remains a bit of a mystery at present...

-Stewart
Jul 7 '08 #8
Annalyzer
122 100+
I was able to make it work by removing the calculated fields, so I'm not worried about resolving why it wouldn't work. I'll set this one aside and try to figure it out when my brain is less taxed. For now, I just want to be done with this project and I think I can see the finish line from here! =)
Jul 7 '08 #9

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

Similar topics

4
by: Lumpierbritches | last post by:
Thank you once again for any and all assistance. I'm building an application that's getting quite bulky due to the number of forms, macros and procedures. I was wondering if there's a way to use 1...
3
by: Neil Guyette | last post by:
Hello, Everyone, I'm trying to find information on how to populate a combo box using a SqlDataReader. I want to be able to set the value of the combo's value property different then the...
3
by: Craig G | last post by:
i've emailed metabuilders themselves but was just wondering has anybody else ever had this problem? I am populating the combobox using a SQL2000 table. The combobox populates successfully with the...
4
by: jon.lewis | last post by:
I'm populating an unbound combo on a form as follows: Dim strRowSource As String Dim mydate As Date mydate = #1/1/2000# strRowSource = Format(mydate, "MMM YY") Do Until Format(mydate, "MMM...
6
by: zuchowra | last post by:
Hi everyone. I need help. I have a combo box in my form that i want to populate multiple text boxes after you select your selection in the combo box. Here is my set up. The Fields that need to be...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
2
by: SHAWTY721 | last post by:
I have a form that contains two combo boxes that are related to each other. I need to find a way to populate my text box based on the criteria of the two combo boxes so the appropriate number...
11
by: jgoodnight | last post by:
Hi, I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo...
0
pod
by: pod | last post by:
I am new to OOD and n-tier architecture but I want to start the right way. In Visual Studio, I have created a solution with three projects c/w reference to each other i.e. the Business Logic...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.