Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reset Combo field?

Status
Not open for further replies.

khwaja

Technical User
Aug 27, 2001
431
AU
I am using a combo field to look up a location which is then shown as sub form with all details. I needed to restrict combo field record list to certain regions so I based the combo field on a parameter query which asks for a Region from user before offering a listing of locations. Whole thing works well. But the only problem is that when user needs to look for a location in another region, he/she needs to close the form first and come back in to invoke parameter query which is cumbersome.

I was wondering if there was a way one could re initialise the combo field to invoke the parameter query. This might be through a command button.

There is another problem I am facing that when user cancels the parameter query, a blank combo field stays on and cannot be used unless one closes the form and comes back in. Is there any way one can close the form when this happens? I am finding it difficult to relate action on parameter query dialogue box to a macro. Would appreciate some help.
 
Simple. Issue a "Me!Combo-boxName.REQUERY" method off a command-button or click-able something on your form.

To handle a "blank" parameter, or a "cancelled" prompt-box, about all you can do is check the combo box AFTER the query has run (and supposedly returned ZERO records), and if the combo has zero records, then make it invisible or run a standard query to give it some values.

The better thing would probably be to re-think the user interface, and have the combo box contents driven by an object that wouldn't return a "null" (like your parameter-driven query), so the combo HAS to have values. Why not give the user a combo box of REGIONS to pick from, to drive the second combo box of things IN that region?


Jim Hare
"Remember, you're unique - just like everonone else"
 
Thanks Jim. I was trying to mark this helpful but I couldn't. I got the following error message which you might want to pass on to the Administrator.

Cheers
Error Occurred While Processing Request
Error Diagnostic Information

An error occurred while evaluating the expression:


#Session.Member.Handle#



Error near line 22, column 57.
--------------------------------------------------------------------------------

Error resolving parameter SESSION.MEMBER.HANDLE


The session variable MEMBER.HANDLE does not exist. The cause of this error is very likely one of the following things:


The name of the session variable has been misspelled.
The session variable has not yet been created.
The session variable has timed out.


The error occurred while processing an element with a general identifier of (#Session.Member.Handle#), occupying document position (22:56) to (22:78) in the template file D:\webs\TEK-TIPS\tipvote.cfm.


Date/Time: 03/03/02 17:29:22
Browser: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)
Remote Address: 203.26.178.150
HTTP Referrer: Query String: spid=700&sqid=213537&VHandle=JimAtTheFAA&VType=MIS&votes=1&w=300&h=200&action=vote&CFID=47469428&CFTOKEN=90967976




Please inform the site administrator that this error has occurred (be sure to include the contents of this page in your message to the administrator).


--------------------------------------------------------------------------------
 
Jim

Sorry to come back on this once again. Is there someway I can incorporate a line of code to refresh the combo box list. For example if you have a combo list of values and user decided to enter a value not in the list, this brings up an error dialogue box offering to cancel the action or go to a form to add a new record for the look up list. But the problem is that when you add a record in the form where combo box is getting its value from, I don't see the newly added record as opart of combo box list as soon as I close the form. What is the best way to get around this problem?

Cheers
 
Well, the REQUERY method will refresh the contents of a combo box. WHERE you issue it is a bit murky here - you can try doing it on the CLOSE event of the pop-up not-in-list form:

Sub Form_Close()
Forms!{Main-form-name-here}!{combo-name-here}.REQUERY

78.5% of all statistics are made up on the spot.
Another free Access forum:
 
Jim

I tried using this code in On Close action of the pop up form as under:

Forms![Projects]![POIDLBL].Requery

But i am getting a runtime error 2450. POIDLBL is the name of combo conrol.

Will appreaciate if you could help.

Cheers
 
Hmmm..the combo isn't on a subform or anything, is it? Your line of code SHOULD work, unless there's something else we're not seeing here.

Check the properties for the combo - make sure there's nothing there that could keep it from refreshing itself.

Don't know what 2450 error means. Could just be that B. Gates had a bad hair day or something.

I'll stay on top of this and try some things here or at the office tomorrow if I get a chance. Things are a bit topsy turvy right now.

78.5% of all statistics are made up on the spot.
Another free Access forum:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top