Problem testing query (1 Viewer)

kirkm

Registered User.
Local time
Today, 12:11
Joined
Oct 30, 2008
Messages
1,257
My query calls a function which isn't working (yet). How can I stop it running?
I've found I need Cntl-Alt-Del End Task, but is there any other way ?
 

June7

AWF VIP
Local time
Yesterday, 16:11
Joined
Mar 9, 2014
Messages
5,470
Some PC's have a BREAK key that can be used to interrupt code execution. Otherwise, no.

Test the function with a small dataset or call it from the Immediate Window.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:11
Joined
Oct 29, 2018
Messages
21,467
Can you post the code for the function?
 

kirkm

Registered User.
Local time
Today, 12:11
Joined
Oct 30, 2008
Messages
1,257
June thanks for letting me know.. I can adjust so it doesn't happen. There is a pause/b key but it doesn't seem to have any effect.
I am attempting to apply the "control source" method you described last week. I did get it working but I'm now trying it in the 'bigger picture' and it's doing my head in! My template is the NoFlicker.accdb that was an example of it working.
What is the actual command that assigns the picture? Is it ImageA's control source =[SubCDTracks].[Form]![CA]
If so, and text box CA holds a jpg filename (which it does and that can be seen on the Form) should the image control be showing that picture? Because it isn't... and a Click event on the image MsgBox Me.Picture shows <none>.
DBGuy the function is called by a query which is the record source for my Subform. It seems to be called once for every record in the Form, which may be right... BUT in NoFlicker.accdb its equivalent query only calls its function once (even though there's 29 records). At least that's my findings so far.
The function (abbreviated, so not showing every Select Field name Is
Code:
SELECT Prefix, ASideThumb([Mode],[Prefix]) AS CA, BSideThumb([Mode],[Prefix]) AS CB
FROM tblMain
WHERE (((tblMain.[Sheet])='ABC') AND ((tblMain.[Year])='1952'))
ORDER BY tblMain.sort;
ASideThumb and BSideThumb return a jpg filePath & name
 

kirkm

Registered User.
Local time
Today, 12:11
Joined
Oct 30, 2008
Messages
1,257
Ok, This has become quite taxing for me as I know what I want to do but not how best to achieve it.
I could do with some advice please
The problem in prev message is solved, by following the example db too closely I'd overlooked a control had a different name.
However now it's working it may not be as good as it could be.
QueryFTSourceTemp runs 2 functions that build an array of picture filenames. It does this repeatedly (and twice doing the same thing)- is that the best solution?
At this stage all the db does is shows 2 images per record on Form1. Incuding all images made the zip too big to upload so have reduced pics to first 3 records only
Thanks for any replies.
 

Attachments

  • MySample.zip
    2.1 MB · Views: 72

June7

AWF VIP
Local time
Yesterday, 16:11
Joined
Mar 9, 2014
Messages
5,470
Strongly advise not to use punctuation/special characters in naming convention. Nor begin names with number. Certainly a field name of [#] is ill-conceived.

Why text fields for numeric data?

Opened qryFTSourceTemp in design view and no tables show. I've never seen this. I rebuilt the query so now table shows in designer.

If I understand correctly, each time a record is selected, global array object is populated and it is the same data. Instead of populating array when record is selected, why not populate array when form opens?
 

kirkm

Registered User.
Local time
Today, 12:11
Joined
Oct 30, 2008
Messages
1,257
The field names are what we want. Some numeric data may become text e.g "-" instead of '0'.
I don't know why no table shows in query design, I may have pasted in the sql without using the query builder Window.
It isn't the same array for every record, only files for that record. Thats why the On Current event was doing it all in VBA. Now using your control source method. Is it as you envisaged? Are the repeated calls to build the array (twice for every record - although only 21 in 1952 there may be hundreds in later years) wrong? It doesn't feel right. It could be populated with every file (for the year) when the Form Loads, then filtered in the function. Is that feasible? It would be huge.
 

kirkm

Registered User.
Local time
Today, 12:11
Joined
Oct 30, 2008
Messages
1,257
Going back to the subform Current event just to populate the Array seems to be working.
 

Users who are viewing this thread

Top Bottom