Continous Form not showing Data from Underlying Query (1 Viewer)

ANProudfoot

New member
Local time
Today, 01:50
Joined
Aug 1, 2019
Messages
5
Hi,

Version of Access = 2010, Version of Windows = Win7.

I have a Form showing results of a set of queries depending on the Arguments passed to the form. In the Form_Load event procedure I alter the .RecordSource property to the required query and Requery, Refresh the Form.

However, on options C and D no results are shown but on options A, L, T and U results are shown?

Attachments:-
ANP1 shows details of the Query for option C.
ANP2 shows the results of Query when just shown in Datasheet view.
ANP3 shows the results of the form when opened with opt C
ANP4 and ANP5 shows that in Debug mode the recordsource property is set correctly and Requery action is performed.

Any help with this issue would be most grateful.

Regards
Adrian.
 

Attachments

  • ANP1.jpg
    ANP1.jpg
    53.1 KB · Views: 59
  • ANP2.jpg
    ANP2.jpg
    74.9 KB · Views: 53
  • ANP3.jpg
    ANP3.jpg
    46.4 KB · Views: 55
  • ANP4.jpg
    ANP4.jpg
    69.5 KB · Views: 52
  • ANP5.jpg
    ANP5.jpg
    70.6 KB · Views: 46

Gasman

Enthusiastic Amateur
Local time
Today, 01:50
Joined
Sep 21, 2011
Messages
14,048
You have way way more experience that I have, but there is no need for a requery if you change the recordsource of the form.?

I would include the criteria fields to start with in the query as nothing jumps out as obvious to me, but then again, not an expert, but I believe the query that you show with data does not have the same company ID?

I cannot see any typo with query name, you have the correct caption, so I would say it is going to the "C" code section, just that the data is incorrect for the query criteria.?

Best I can offer, sorry.
 

ANProudfoot

New member
Local time
Today, 01:50
Joined
Aug 1, 2019
Messages
5
Gasman,
Thank you for the reply.
the difference in the CompanyID is one is the UniqueID and the other is the Description.

I have tried the moving of the selection criteria as suggested and even removed all the selection criteria from the query and still get the same issue?

I have also removed the tblAssets.* and inserted just the required fields and still get no results?

Once again I appreciate you reply.

Regards
Adrian.
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:50
Joined
Sep 21, 2011
Messages
14,048
What can I say? It is going to be what I call a 'silly' error I expect.

What happens if you run the query whilst the form frmhidden is open with whatever values it is meant to have.

In the debug window put a breakpoint on the Select case and in the immediate window, enter

Code:
? currentdb.QueryDefs("qryViewAssetsCurrent").SQL
what does that show?

If you paste the output into the sql window of a new query, what does that produce.?

HTH
 

ANProudfoot

New member
Local time
Today, 01:50
Joined
Aug 1, 2019
Messages
5
Hi Gasman,

I have tried what you suggested and surprise surprise when I run the new query it comes up with no records?

Unhiding the hidden forms has no affect - See ANP6

See ANP7 for the results of the debug line in the new query in sql view, ANP8 shows it in design view, And ANP9 shows it in Datasheet view.

Again your help is much appreciated

Regards

Adrian
 

Attachments

  • ANP6.jpg
    ANP6.jpg
    76.9 KB · Views: 39
  • ANP7.jpg
    ANP7.jpg
    32.5 KB · Views: 36
  • ANP8.jpg
    ANP8.jpg
    52 KB · Views: 40
  • ANP9.jpg
    ANP9.jpg
    45 KB · Views: 38

Gasman

Enthusiastic Amateur
Local time
Today, 01:50
Joined
Sep 21, 2011
Messages
14,048
That is what I expected. the criteria is not producing any records.

Now you need to find out the difference with the one you posted initially.?

I believe that is where the problem lies. you do not appear to be using a very similar named query, which is often the case.?

What is the value of txtUserCompany on the hiddendetails form?

You need to inspect the controls being used in the query at that time.?

HTH
 

ANProudfoot

New member
Local time
Today, 01:50
Joined
Aug 1, 2019
Messages
5
I can find no differences between the two sql statements.

I have tried recreating the query, and even recreating the entire Database, which did resolve an other I had, but to still no joy.

Any other suggestions any one?

Regards
Adrian
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:50
Joined
Sep 21, 2011
Messages
14,048
Upload a cut down version of your db as a zipped file.
Give details as how to replicate the problem.

Unfortunately I only have 2007, so unlikely to help with that though, sorry.
 

Users who are viewing this thread

Top Bottom