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

Displaying Images Efficiently

675 512MB
Each time I move to a different record, I want to display a picture, if available, stored separately from the database. If I have more than one picture, then I will put navagation arrows below the first picture shown.
I know how to display these pictures without having them embedded in the tables.

The form is bound to a table with PK=autonum. I have a table=tPicNames
Expand|Select|Wrap|Line Numbers
  1. Key        AutoNumber (PK)
  2. ptr        Long Integer (FK)
  3. FileName   Text
  4. PicOrder   Long Integer
  5. ...
Therefore,
Expand|Select|Wrap|Line Numbers
  1. SELECT FileName FROM tPicNames WHERE ptr=1234 ORDER BY PicOrder
where 1234 is the current key of the record being displayed.
So I will need to know if I have zero, one, or many pictures for this Key. If not zero, I will need to get the Text of the first picture (which is the picture name).
I could do this with a .visible=false ListBox on my form, a form which is hidden, or a recordset (which I don't know how to do.)
What is fastest?
What causes least bloat?
Does it matter if most records have many pictures? If most have only one picture?
If using a recordset, should it be freed each time new key, therefore new query?
Mar 21 '09 #1
3 1427
ADezii
8,834 Expert 8TB
@OldBirdman
Assuming the [FileName] Field cannot be NULL, you can try something like this:
Expand|Select|Wrap|Line Numbers
  1. Dim intNumOfPicsPerKey As Integer
  2. Dim strSQL As String
  3. Dim lst As ListBox
  4.  
  5. '[txtCurrentKey] - Text Box on Form that contains the Current Key Value
  6.  
  7. 'Reference to List Box that will contain Filenames ([lstFileNames])
  8. Set lst = Me![lstFileNames]
  9.  
  10. lst.ColumnCount = 1
  11.  
  12. strSQL = "Select tPicNames.FileName From tPicNames Where tPicNames.ptr = " & _
  13.           Me![txtCurrentKey] & " Order By tPicNames.PicOrder;"
  14.  
  15. If Not IsNull(Me![txtCurrentKey]) Then
  16.   intNumOfPicsPerKey = DCount("*", "tPicNames", "[ptr] = " & Me![txtCurrentKey])
  17.     If intNumOfPicsPerKey > 0 Then
  18.       lst.RowSource = strSQL
  19.     Else
  20.       lst.RowSource = ""
  21.     End If
  22. End If
Mar 21 '09 #2
OldBirdman
675 512MB
This requires a listbox=lstFileNames (hidden?) on the form. It is what I am now doing, and the code looks logically the same.

The reason for my post is a question of efficiency. After trying to initialize a listbox using a function, I realize that Access doesn't store the information in the listbox beyond those that can be displayed. As there is no ListRows property for listboxes, the number of rows is dependent on the height and the font size, and I am unsure how Access deals with a listbox on a form with a small height.

I was also wondering if DCount was more efficient than .ListCount, a property of the listbox.

Expand|Select|Wrap|Line Numbers
  1. Set lst = Me![lstFileNames] 
  2. lst.ColumnCount = 1 
If lstFileNames.ColumnCount were not already 1, would this change it? From A02 Help
Generally, when you use Set to assign an object reference to a variable, no copy of the object is created for that variable. Instead, a reference to the object is created.
What is intended here?
Mar 22 '09 #3
ADezii
8,834 Expert 8TB
@OldBirdman
and I am unsure how Access deals with a listbox on a form with a small height.
If a List Box cannot accommodate the number of Rows Vertically, Scroll Bars will then appear.
I was also wondering if DCount was more efficient than .ListCount, a property of the listbox
I though the concept was to determine how many Pics existed for any given Key, then to branch off from there. It is within this context that DCount() is being used.
What is intended here?
Nothing more than how to Set an Object Reference, then set Properties for the Object dynamically.
Mar 22 '09 #4

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

Similar topics

11
by: Ian Davies | last post by:
Hello Im having problems displaying my images as thumbnails in a table. My code for producing the new width and height from the original image is as follows...
2
by: Woodmon | last post by:
I'm observing issue with linked images not displaying in either Firefox 1.5b2 or IE6 when running on Win XP (they display fine in either browser on W2k). Example problem HTML is: <a...
3
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or...
1
by: tshad | last post by:
Is there some reason why the Hyperlink in a DataGrid will not show an image? I have a datagrid with the following: <asp:TemplateColumn visible="false" HeaderText="Skills"> <itemtemplate>...
1
by: David Lozzi | last post by:
Hello, I'm wondering whats the best method to use for displaying several photos' thumbnails. One method I know is to dynamically resize the photo at the time the page is loaded. What does this...
10
by: gnewsgroup | last post by:
I've googled and tried various approaches, but could not resolve this problem. The article at MSDN: Displaying Images in a GridView Column only presents a simple case where all data (including the...
5
by: Tom | last post by:
VS 2003/C# Have a axWebBrowser control that will not render images. Originally our app was just launching IE7 to display an HTML page. The bitmap images were not displaying - path was correct...
4
by: redpears007 | last post by:
Hi Again, Throwing this one out to you again as i am not getting anywhere and can find little to no information out there. I am currently displaying images (Jpegs) in access via the routine...
7
by: Sonasang | last post by:
Hi , I am creating a web page in ASP. I will place some images in the folder, The images placed in the folder should be disaplayed. I am having the two button in the web page if I click next...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.