473,405 Members | 2,344 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,405 software developers and data experts.

problem after load images in database..

hi...i got a problem..i need a help..when i hv load 38000 image files
in database ..i need to sort the file refer to the name of the
file..like a103.bmp,a104.bmp,a105.bmp..bc*oz when i sort it..it has
been like this..a103.bmp,a1031.bmp,a104.*bmp,a1041.bmp...can u help
me??is there any coding in vba which can solve this problem??? plz i
really need a help...tq.....

Aug 25 '06 #1
5 1613
you have to split the text prefix and the number and sort by each one.
If you concatenate text and numbers, you'll get text sort orders. Use
LEFT, RIGHT and MID to split off the two parts into two different
fields in a query and sort by the textpart and then the numeric part.

Aug 25 '06 #2
What is happening here is that the filenames are sorted as characters
and not as numbers..So 1000 comes before 2. Do you have a field where
you store the filename? You need to sort on an expression which takes
the part of the filename which looks like a number and converts it to a
number that you can sort on. Using Val(string) converts the string to
a number.

assuming your name has a character 'a' then the number and then '.bmp':

first :You have to get rid of the file extention .bmp.

Use a string expression that takes all the characters starting fron the
left except the last 4. Assuming the field with the filename is called
'filename',

Left([filename];Len([filename])-4)
will do that for you.

Next get rid of the 'a' in front of the filename. You need the
rightmost characters except for the first one.
Right([Expr1];Len([Expr1])-1)
will do that, where Expr1 is the result of the previous step.

Now all you need is Val(Expr2) (the result from the previous step)
which will give you the number part of the filename as a number you can
sort on.

Of course you can combine the above steps into one.

Val(Right(Left([filename];Len([filename])-4);Len(Left([filename];Len([filename])-4))-1))

You can put this expression in a query and sort on this.

Hope this helps.

Phivos

leen wrote:
hi...i got a problem..i need a help..when i hv load 38000 image files
in database ..i need to sort the file refer to the name of the
file..like a103.bmp,a104.bmp,a105.bmp..bc*oz when i sort it..it has
been like this..a103.bmp,a1031.bmp,a104.*bmp,a1041.bmp...can u help
me??is there any coding in vba which can solve this problem??? plz i
really need a help...tq.....
Aug 25 '06 #3
thank you Phivos...can u giv any coding on that???
Phivos wrote:
What is happening here is that the filenames are sorted as characters
and not as numbers..So 1000 comes before 2. Do you have a field where
you store the filename? You need to sort on an expression which takes
the part of the filename which looks like a number and converts it to a
number that you can sort on. Using Val(string) converts the string to
a number.

assuming your name has a character 'a' then the number and then '.bmp':

first :You have to get rid of the file extention .bmp.

Use a string expression that takes all the characters starting fron the
left except the last 4. Assuming the field with the filename is called
'filename',

Left([filename];Len([filename])-4)
will do that for you.

Next get rid of the 'a' in front of the filename. You need the
rightmost characters except for the first one.
Right([Expr1];Len([Expr1])-1)
will do that, where Expr1 is the result of the previous step.

Now all you need is Val(Expr2) (the result from the previous step)
which will give you the number part of the filename as a number you can
sort on.

Of course you can combine the above steps into one.

Val(Right(Left([filename];Len([filename])-4);Len(Left([filename];Len([filename])-4))-1))

You can put this expression in a query and sort on this.

Hope this helps.

Phivos

leen wrote:
hi...i got a problem..i need a help..when i hv load 38000 image files
in database ..i need to sort the file refer to the name of the
file..like a103.bmp,a104.bmp,a105.bmp..bc*oz when i sort it..it has
been like this..a103.bmp,a1031.bmp,a104.*bmp,a1041.bmp...can u help
me??is there any coding in vba which can solve this problem??? plz i
really need a help...tq.....
Aug 28 '06 #4
thank you Phivos...can u giv any coding on that???

Aug 28 '06 #5
helo Phivos...i've follow ur instruction..but i got a problem...when i
run the code..it will said.."wrong number of arguments used with the
function in query expression"...can u help me???...is there anything
wrong???this is my coding
SELECT [tblLoadOLE].[OLEPath]
FROM tblLoadOLE
ORDER BY
VAL(Right(Left([OLEPath].Len([OLEPath])-4).Len(Left([OLEPath].Len([OLEPath])-4))-11));

Aug 29 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Trevor Fairchild | last post by:
I am making a program that categorizes pictures. The picture paths are stored in an Access Database, vb6 connects using adodc controls. This program works specifically with .jpg files. It will be...
4
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data...
2
by: Julie | last post by:
Hi, I'm trying to change images on a website without reloading the whole page and use the following code to preload the images: var preloadFlag = false; function preloadImages() { if...
2
by: Mehdi | last post by:
Hi, I have 3 small images on my page. I also have a large image which is displayed when any of the 3 small images is clicked. I do this to display a large version of each image. On page load...
3
by: Bob Dydd | last post by:
Hi Everybody I have an Access 2000 db with a setup for inserting images in records. I am using the image path only with the actual images stored elswhere on the hard disc. This works perfectly...
2
by: Evan | last post by:
I have an aspx page that can take a minute or so to load because it loads images from a database. I want to open a window and show a "Please Wait" message page at the start and close it when the...
11
by: ste | last post by:
Hi there, Further to my recent posts where I've received excellent help from Rik and Jerry, I've ended up with an image gallery on my website that displays images in a table, 3 images per row. ...
0
by: Dionysusmtl | last post by:
I'm working on a flash portfolio that loads examples of our work (jpgs) into a movie. For example, it started off using an xml list to display certain images but I found it necessary to draw info...
4
by: jphaycock | last post by:
Hi I have a webform in a sub folder called admin. The form has a file upload control on it. I'm trying to upload an image file to the root images folder of the app like this: filePath =...
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.