John W. Colby
jwcolby at colbyconsulting.com
Wed Aug 11 17:34:06 CDT 2004
It turns out that mid() is a keyword that accepts parameters and inserts a string inside another. mid(strToMerge, lngPosToInsert)= strToInsert Something like that John W. Colby www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Wednesday, August 11, 2004 3:06 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] formatting strings and placing them in a larger string Well, this part is easy. I named the following function after several similars that I learned in dBASE, Clipper, etc. <Code> '----------------------------------------------------------------------- ---------------- ' Procedure : Replicate ' DateTime : 8/11/2004 15:00 ' Author : Arthur Fuller ' Purpose : return a string consisting of the input char replicated to N length ' Notes : ' : ' Revisions : ' : '----------------------------------------------------------------------- ---------------- ' Public Function Replicate(strChar, intCount) As String Dim strResult As String Dim i As Integer On Error GoTo Replicate_Error For i = 1 To intCount strResult = strResult + strChar Next Replicate = strResult On Error GoTo 0 Exit Function Replicate_Error: MsgBox "Error " & Err.Number & " (" & Err.Description & ")" & _ vbCrLf & _ "in procedure Replicate of Module aaLib" End Function </Code> -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Colby, John Sent: Wednesday, August 11, 2004 1:33 PM To: 'accessd at databaseadvisors.com' Subject: [AccessD] formatting strings and placing them in a larger string I need to take some piece of data, format it correctly (yyyymmdd for dates, $$$$.CCCC for currency, XXXX.DD for other floats, etc. I then need to place it in a specific length field, padded left with spaces. I then need to insert that string inside of a larger string at a specific location. Someone posted a solution for placing a string inside a larger string but I can't find the email. I can build up a string of @ characters into the correct length using a simple: While Len(strPad) < mintLen strPad = strPad & "@" Wend But is there any way to just specify that I want a string of 40 @ characters? JWC -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com