VB code for creating a Disk preview name from a RID


<< Extracting Finder comment ...
Back to Portfolio FAQ index
New Galleries open behind ... >>

Use this code snippet to take a RID and return a correctly formatted Disk Preview name. Disk Preview files are generated with a name like p0000000142.jpg. How does the syntax of our example Preview name break down?

Function RIDFileName(strRID as string)
 
dim lngPLen as Long
dim lngRIDLen as Long
dim lngPadx as Long
dim strPrevName as String
dim lngCnt as Integer
 
' 10 digit pad precursor
lngPLen = 10
 
' determine # digits in RID
lngRIDLen = Len(strRID)
 
' set # padding zeroes needed
lngPadx = lngPLen - lngRIDLen
 
' set preview name string precursor
strPrevName = "p"
 
' add appropriate # zeroes to name string
For lngCnt = 1 to lngPadx
   strPrevName = strPrevName & "0"
Next
 
' add RID and extension
RIDFileName = strPrevName & strRID & ".jpg"
 
End Function

' Insert the Record_ID below inside the parentheses.
' Message box will display the preview filename.
MsgBox (RIDFileName(32))



Question: VB code for creating a Disk preview name from a RID [FAQ00202.htm]
Last Update:- 01 June 2006


<< Extracting Finder comment ...
Back to Portfolio FAQ index
New Galleries open behind ... >>

Quick Search of PortfolioFAQ (word, words or phase): or try the Advanced Search

User-to-User Forums  |  Report error/typo/broken link  |  Request new topic  |  Ask a question

Site and articles © Mark Anderson 2001-2007 - Visit my home page


This FAQ is created and maintained using
Friday logo
Friday - The Automatic FAQ Maker