[AccessD] import text

Paul Hartland paul.hartland at googlemail.com
Tue Apr 16 05:56:37 CDT 2013


could you post the full function as you now have it please

Paul


On 16 April 2013 13:46, <pedro at plex.nl> wrote:

> I all did this and it did not work.
>
> I copied and past the functionname and brackets and now its working.
>
> But now i get an error: "invalid Filename or invalid filenumber", and
> yellow highlighted is "Open strFilename For Input As #ff" after debugging.
>
> ???
>
> Thanks
>
> Pedro
>
>
>
>
> Also make sure that you put the empty brackets after the function name in
> the macro.
>
>
> On 16 Apr 2013 at 20:22, Stuart McLachlan wrote:
>
> > If it's in a module and you want to call if from anywhere outside the
> module, you need to
> > make it Public.
> >
> > If you are calling it from a Macro, rather than an Event Procedure, you
> need to make it a
> > Function, not a Sub.
> >
> > " Public Function melanomen() "  should work.
> >
> > In your macro, make sure that you put an equal sign in front of  the
> Function name i.e.:
> > =melanomen()
> >
> > --
> > Stuart
> >
> > On 16 Apr 2013 at 11:30, pedro at plex.nl wrote:
> >
> > >
> > > Dear Stuart, dear List,
> > >
> > > i overlooked the comma, sorry :-(
> > >
> > > The compiling now is ok.
> > >
> > > I have placed the code below in "Module1"
> > >
> > > but when is try to call this code with a macro of commandbutton on a
> form i get an error: "the expression that you call on, has a function name
> that is not known in access"
> > >
> > > i don't get it, i also tried Private Function melanomen()  or   Public
> Function melanomen()   ------ End Function in the code.
> > >
> > > What is going wrong?
> > >
> > > Thanks Pedro
> > >
> > >
> > >
> > > <code>
> > >
> > >
> > > Option Compare Database
> > > Option Explicit
> > >
> > > Private Sub melanomen()
> > >
> > > Dim ff As Integer
> > > Dim strTemp As String
> > > Dim strOutputLine As String
> > > Dim strResult As String
> > > Dim strDQ As String
> > > Dim strFilename As String
> > > Dim strOutput As String
> > > FreeFile ff
> > > strDQ = Chr$(34)
> > >
> > > strFilename = "C:\Temp\Test_Import.txt"
> > >
> > > Open strFilename For Input As #ff
> > > Line Input #ff, strTemp
> > >
> > > While Not EOF(ff)
> > >    If Left$(strTemp, 2) = "**" Then 'Build initial quote/comma
> delimited string
> > >    strOutputLine = Replace(strTemp, " ", strDQ & "," & strDQ)
> > >    'add start and end quotes
> > >    strOutputLine = strDQ & strOutputLine & strDQ
> > >    End If
> > >
> > >    If Left$(strTemp, 10) = "CONCLUSIE:" Then 'Get next line
> > >        Line Input #ff, strTemp
> > >       strOutputLine = strOutputLine & "," & strDQ & strTemp & strDQ
> > >    End If
> > >
> > >    If Left$(strTemp, 10) = "DIAGNOSES:" Then 'Get next line
> > >        Line Input #ff, strTemp
> > >       strOutputLine = strOutputLine & "," & strDQ & strTemp & strDQ
> > >       'and append this line
> > >       strResult = strResult & vbCrLf & strOutput
> > >    End If
> > >
> > >    Line Input #ff, strTemp
> > > Wend
> > > Close #ff
> > > Debug.Print strResult
> > >
> > > End Sub
> > >
> > > </code>
> > > --
> > > 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
> >
>
>
>     Previous message: [AccessD] import text
>     Next message: [AccessD] import text
>     Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>
> More information about the AccessD mailing list
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



-- 
Paul Hartland
paul.hartland at googlemail.com


More information about the AccessD mailing list