I cannot explain this behaviour - can anyone help?

u0107

Board Regular
Joined
Dec 18, 2002
Messages
154
Hello all,

I have an application in Access-2000 with more than 20 forms.

Many of the forms are query based. Some queries are generated as soon
as the Application's authorization is verified - I use the ADODB way
to generate the queries. Some others are generated just before a form
is Opened or Loaded.

The flow of the application is as follows:

Form 1 - Main Switchboard - I verify the user's authorization.
Form 2 - Selection Menu - I allow the user to choose a State Code (MD,
NJ, etc)
Form 3 - City Selection Menu - Based on the state code chosen - I
display a list of cities in a drop down box for the user to choose.

Once the user has been determined to be authorized, there is no involvement of Form 1 in the problem I am about to describe:

This is what I observe (and which I cannot explain) :rolleyes: :

On Form 2 I choose NJ. I am shown a set of cities on Form 3.

I close Form 3 and once again choose NJ on Form 2. This time I see a
set of cities which I know are of NJ.

Now I close Form 3 again and this time I choose MD on Form 2. I
continue to see the cities of NJ.
:(
I close Form 3 and choose MD A SECOND TIME. Only THIS TIME, I see the
cities of MD. :(

Now if I close Form 3 and choose a different state, say DE, I continue
to see MD Cities.

To Generalize: Only when I choose a state A SECOND TIME do I see the cities of that state.

The query which is behind Form 3 is a ADODB Query in cat.views and is
named "Form_3_Query_1" and which is assembled on the fly in the On
Load Event Procedure of Form 3. The value of MD, or NJ or DE or any
state code chosen on Form 2, gets loaded into a global variable which I use in the "WHERE" statement of the assembled Query String as follows:

"WHERE (tblcities.state_code = " & chr$(34) & <global_variable_state_code> & chr$(34) & "));"

FYI chr$(34)is the double Quotes.

I am guessing that it could be solved with an appropriately placed "Requery" statement but am not sure whether as also where
specifically.

Thanks in advance.

Cheers!

Uttam
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Assuming you have a combo box on Form 2, with Form 3 criteria linked to it...
Go to the AfterUpdate event of the Form 2 combobox and insert
[Forms]![Form3].[Requery]

That should do it.

HTH

Denis
 
Upvote 0

Forum statistics

Threads
1,221,553
Messages
6,160,467
Members
451,649
Latest member
fahad_ibnfurjan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top