473,395 Members | 1,616 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,395 software developers and data experts.

Requery Subform

I am new to MS-Access, but not to programming in general.

I have a main form and two sub-forms:
The main form is frmLTSMain. Subform frmDataApps is related to frmLTSMain; subform frmLTSDataLoads is related to frmDataApps.

When I move the record pointer in frmLTSMain, the correct records are shown in both subforms initially. However, when I move the record pointer in subform frmDataApps, subform frmLTSDataLoads does not requery. I created custom queries to populate both subforms, so that I can hid the unneeded primay key fields.

I thought by establishing referential integrity between the main form and the subforms, the record pointer movement would be handled by Access.

I've tried all variants of syntax that I can find on the web and none of them work. Any help would be appreciated.

** Edit **

Attached Images
File Type: jpg accessrequery.jpg (13.3 KB, 198 views)
Feb 22 '11 #1
9 1324
NeoPa
32,556 Expert Mod 16PB
So, it seems you have a main form, a sub-form, and a sub-sub-form. Not a main form with two sub-forms.

Please describe the structure fully with steps you've taken so far to establish the linking between the forms. I expect we would also need a clear description of the tables/queries involved in your forms, with related info on how they link together.

Without this information there is very little question to work with.
Feb 23 '11 #2
Correct, I have a main form a sub-form and a sub-sub form.

The main form is frmLTSMain
frmLTSMain is parent to child frmDataApps
frmDataApps is parent to child frmLTSDataLoads

I placed the below code in the On Current event in form frmDataApps thinking it would requery its child form. I am also not sure if I'm using the correct event or if I'm placing it in the correct location.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.   [Forms]![frmLTSMain].[Form]![sbfrmLTSDataLoads].Requery
  3. End Sub
When I run the above line, the error is:

Run-time error '2465':

Microsoft Access can't find field 'sbfrmLoadFieldLocation' referenced in your expression.
Feb 23 '11 #3
As a follow-up, I've attached a picture of the form. When it first loads, everything is OK. However, looking at the sub-form, if I move the record pointer from record RequestNo 001 to record RequestNo 002, the sub-sub-form is not refreshed as I thought it would be, based on the relationships that I've set.

** Edit **

Attached Images
File Type: jpg LTSMain.jpg (43.9 KB, 180 views)
Feb 23 '11 #4
NeoPa
32,556 Expert Mod 16PB
When I say to describe the structure fully I don't mean simply to indicate which forms are connected in your head to which other forms. I mean that to should specify which properties of which forms were set in which way to define the structure that reflects how you think they should connect together.

I believe the Form_Current() code you have posted should be unnecessary. I won't dwell on that as splitting a thread into different problems is never a good idea (nor is it allowed). I will merely mention that the reference is not correct. I can't say much at this time as I don't know enough about your setup, but more help on that can be found at Referring to Items on a Sub-Form.

I'm confident that the solution to your issues can be found in the design and setup of your forms. This is what we still need to know about if we're to help you further.
Feb 23 '11 #5
The reference page was useful information, but didn't really address my issue; and I'm not sure I understand your question.

I've attached a sample DB. There is one record in the main form, seven records in the sub-form, and one record in the sub-sub-form. No matter which record I select in the sub-form, the sub-sub-form shows the same record. Again, I thought the relationships that I’ve established would case the record pointer to move appropriately.

I'm trying to fix this for a person who knows less than I do about Access, so it’s a case of the blind leading the blind. In the course of 'fixing' the problem, I deleted all 'unnecessary' objects and renamed the remaining objects to add some form of consistency in naming conventions. As a result, if you open the DB, you'll get an error message about a missing form. I don’t think that has any impact on my real problem.
Attached Files
File Type: zip SampleDB.zip (58.8 KB, 75 views)
Feb 23 '11 #6
NeoPa
32,556 Expert Mod 16PB
It's normally good etiquette to wait to be asked before posting a database, as that generally involves more time and effort than contributors are offering. In this case though, as you seem to have got as far as you can with explanations, and you're relatively new, and have clearly made an effort to explain as well as you can, I'll make an exception to my usual rule of simply ignoring posted databases that weren't requested, and look at it for you. I'm sorry to say though, that as it's now 01:00 I may not get around to looking at it until tomorrow for you. Answering simple posts is much less time-consuming than dealing with a posted database. Pop back in tomorrow and see if I've had time to check this out for you (or simply wait for the notification if that's how you interact with the site).
Feb 24 '11 #7
NeoPa
32,556 Expert Mod 16PB
I managed to take a look at it today.

I was quite surprised to find that almost all the information provided was inaccurate in one way or another. With such an overload of issues to look at I wasn't in a position to list all of them. I would just suggest in future that you take a little more care when posting information. It is critical when asking for help, and it's not generally appreciated to find oneself wasting time on incorrect information.

I think I was able to recognise most of what I needed though. What struck me as the root of your problem was one of the items where you'd reported something different from what I found was actually the case. Instead of a main form, with a subform which itself had a further subform, I found a main form that had two separate subforms on it.

From what you've already posted I would guess you already understand enough to realise that what you are hoping for is not possible when set up as it is. Of course, subforms are only available to a form when it is displayed in one of the Form views, and not when displayed as a Datasheet (as you have them).

What you have :
Expand|Select|Wrap|Line Numbers
  1.  _________
  2. |    A    |
  3. |_________|
  4.  _|_   _|_
  5. | A1| | A2|
  6. |___| |___|
What you need :
Expand|Select|Wrap|Line Numbers
  1.  _______
  2. |   A   |
  3. |_______|
  4.  ___|___
  5. |   A1  |
  6. |_______|
  7.  ___|___
  8. |   A1i |
  9. |_______|
Feb 25 '11 #8
I truly appreciate your efforts and any false information that I provided was a result of a lack of knowledge and nothing more. It is clear that I am a novice with Access. I’ve developed on other platforms for over 15 years, so I figured there had to be more than one way to “skin this cat.” I purchased a book, did some research, and solved this problem by creating a sub-datasheet; thus eliminating what I called the “sub-sub-form.” Again thanks for your help. I promise not to trouble you again.
Feb 25 '11 #9
NeoPa
32,556 Expert Mod 16PB
Johnnie, My comments were not based on expectations of an Access person. They were based on expectations of an approach when asking for help. Perhaps I laid it on a bit thick, for which I apologise, but it really shouldn't be too much to expect a member to expend a little effort to ensure what they post accurately reflects the problem they are describing. I'm not talking a few minor inconsistencies here. Many things I found to be different from what you described.

In truth, I can live with that with a new poster, but would be disappointed were I to find the same situation in future threads from you (hence my comments). Alternatively, if you choose to have no more dealings with me, I can respoect that too.
Feb 25 '11 #10

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

Similar topics

0
by: Michelle | last post by:
Hi all I have a main form which has a combo box and a subform. The two forms are linked by ShiftPatternName which is basically the value in the combo. the combo has the following code ...
2
by: amywolfie | last post by:
I have read the other posts on this topic, but didn't find an answer specific to what I need. I have a main form: frmFeeInput, which contains 2 subforms: 1) sfrmFootnotes 2) sfrmLoanProducts ...
4
by: mooseshoes | last post by:
All: Form A: Main_Form Form B: Sub_Form (has the control name: Sub_Form_Control_Name) Form C: Independent_Form Form C is based on a table which is also used by Form B. When Form C is used...
14
by: Kurt | last post by:
I have an unbound main form with an unbound subform. frmProjects fsubProjectList Using combo boxes, the user can select several search criteria on frmProjects and then click a command button....
7
by: SBC News Groups | last post by:
I have a form that the user enters some information on and then clicks a button to save the record. I do with the following line: DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,...
1
by: Alessandro | last post by:
Io devo aggiornare i campi di una sottomaschera. Con una maschera normale uso il comando docmd.requery !! ma con una sottomaschera non so come scrivere il codice
3
by: LROCCO | last post by:
Hi, I have a form which contains a subform. When I'm entering data into the subform it seems to requery automatically. When this occurs the focus goes to the start of the subform. Firstly,...
2
by: bbatson | last post by:
Hello, I have created a form that allows the user to search a sales table with the option to choose 1) a sales representative and 2) a car type matching any portion of the inputted text. For...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.