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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question re: Requerying subform

Status
Not open for further replies.

Paul7905

MIS
Jun 29, 2000
205
US
I have two tables, a "business location" table (location 1. location 2., location 3. and so on)

and

a "location" table (the location table consists of inventory "locations" within a business location).

The business location records have a LOCATION ID field and the location table records have a corresponding LOCATION ID.

I designed two forms, one displays "business location" and the other displays "locations" within a business location (i placed both these forms on a main form so in fact, I have two subforms on a main form).

When the user selects a business location on the "business location" subform, I requery the other "location" subform so that it only displays the locations that are pertinent to the business location selected.

The "requery" of the location table works ok with one exception....... when the user browses through some locations on the "location" subform and then changes the "business location" and i requery the location subform, the requery action does not set the record it displays to the first record in the underlying table but retains the record pointer number that the user was last on prior to changing the business location. I.E., if the user was looking at the fourth record for business location one (1), when they switch to business location two (2) and i requery the location form, the fourth record for location 2. is displayed.

question: is there a way, when doing a subform requery to reset the record pointer so that the requery displays the first record in the query result set rather than the record number that was displayed in a prior requery?? ??

thanks

Paul
 
It is not clear what do you wish (my English is a little poor), but I think that when you refresh the recordset of SpecSubForm you want to select the first record in it.

a way:
Forms![SpecMainForm]![SpecSubForm].Form.Recordset.MoveFirst
 
Thanks for the tip! believe it or not, the variant of the requery action i was using would requery the subform but would not set the result set to the first record in the result (would use the record pointer that was in use prior to the requery).

This is the code i was using (DOES NOT set the requery to point to the first record in the result)


This does not return the first record in the result:

Forms!LocTableMaint1!LocTableMaint.Requery



I changed the format of the requery to appear as follows and it works fine (the first record in the result is always displayed). Access is obviously making some sort of distinction as to how it conducts the requery action based on the presence of the .Form. text being present in the statement!


This example returns the first record in the result:

Forms!LocTableMaint1!LocTableMaint.Form.Requery
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top