Results 1 to 10 of 10
  1. #1
    jtmedin is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Posts
    6

    access 2007 vba .movenext

    i have an access table with filename entries as follows:
    p1.tif
    p2.tif
    p3.tif
    p4.tif
    p5.tif
    p6.tif
    p7.tif


    p8.tif
    p9.tif
    p10.tif

    Then normal ascending sort does this:
    p1.tif
    p10.tif
    p2.tif
    ...

    So i wrote a sort - click advance, click advanced filter/sort ... to put then back in order by number. The display of the table shows them in the order i wanted.

    Then my vba pgm did a rs.movefirst & got the filename p1.tif later i did a rs.movenext & got the filename p10.tif :-(. So what am i doing wrong? TIA

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    applying a filter/sort to a table does not sort it's source recordset in vba. It is a temporary fix only through the interface.

    what you really should do here is add a mask or something to your table field, or run code on it if the data is already there, such that you get:

    p01
    p02
    etc...
    p10
    etc...

    that will fix the problem

  3. #3
    jtmedin is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Posts
    6
    Quote Originally Posted by ajetrumpet View Post
    applying a filter/sort to a table does not sort it's source recordset in vba. It is a temporary fix only through the interface.

    what you really should do here is add a mask or something to your table field, or run code on it if the data is already there, such that you get:

    p01
    p02
    etc...
    p10
    etc...

    that will fix the problem

    Ok but i am not referencing the original directory. The table contains the filenames & i am using rs.movenext to get the next record in the table. So u are saying that the view i have of the table is wrong? Since applying the user defined sort, the table records appear to be in the order i want.
    My question now is what good is the user defined filter/sort :-( SIGH!
    Last edited by jtmedin; 06-10-2011 at 03:27 AM.

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    it's good for looking at a table if it's not ordered the way you want it..

  5. #5
    jtmedin is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Posts
    6
    I have given up on putting the directory in a table. There is too much programing & too many options to cover :-(. What i need to do is read directly from the file that the scanner makes. So have been looking @ read & am confused. Need something in vba that will read an external (to access) file. Any ideas? TIA

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by jtmedin View Post
    Need something in vba that will read an external (to access) file. Any ideas? TIA
    you can read files by using I/O. for instance:

    Code:
    dim ff as freefile()
    
    open "c:\myfile" for output as #ff
    
    'continue with operation...
    
    'EXAMPLE
    print #ff, "this is the first line of my new text file"
    printing FROM a file to access uses INPUT instead of OUTPUT.

  7. #7
    jtmedin is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Posts
    6
    Ok tried some of that, problem is i need to read the directory 'c:/tmp/scans/' . Tried several options for read ie 'binary access read' but vba doesnt like the path. Also tried just input ... . No banana :-(.

  8. #8
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    you're being extremely unclear here.

    I have no idea what you want. all I know is that you have a directory of .tif files. You have never said what you want to do with them, and how it relates to I/O procedures.

    Actually, using I/O on picture files I doubt would work. I have no idea why you'd wanna try that anyway.

  9. #9
    jtmedin is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Posts
    6
    I want the file names. After some thought i dont believe its easy to get the directory. Perhaps i ask too much of vba. I believe 'read' expects to read lines from the file not lines from the directory :-(.

  10. #10
    jtmedin is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Posts
    6
    it occurs to me i have missed something with the design of my sort. I had 2 columns one sorted the major numbers & the other column sorted the major numbers. What should i have for the 'criteria'. What i want is the major sort & then the minor sort to produce the table. ie

    456p1.tif
    456p2.tif
    457p1.tif
    457p2.tif
    457p3.tif

    any ideas? TIA

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Saving Access 2010 database to Access 2007
    By Bajaz001 in forum Access
    Replies: 2
    Last Post: 04-11-2011, 12:59 PM
  2. rs.FindNext vs. rs.MoveNext
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 02-04-2011, 03:13 PM
  3. Replies: 6
    Last Post: 12-01-2009, 11:59 AM
  4. Replies: 0
    Last Post: 11-17-2009, 02:35 PM
  5. Replies: 32
    Last Post: 09-16-2009, 10:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums