Derek,
Try making it Public Function, not Private.
Also, I am not sure about the "acImport" in your code. It might be ok, but
as far as I know, the options for TransferText should be acImportDelim,
acImportFixed, or acImportHTML.
Also, I assume you have created an Import Specification named "AdjLiveRpt"?
As an aside, the SetWarnings actions in the macro don't achieve anything in
this case, so they can be removed.
My other question would be, if you are using a RunCode action in a macro to
run a TransferText method... why not just simply do the TransferText action
directly in the macro? Easier.
--
Steve Schapel, Microsoft Access MVP
"Derek" <(E-Mail Removed)> wrote in message
news:A10A6762-FB37-4C89-985E-(E-Mail Removed)...
> Steve,
>
> Alright.. I am having trouble with this. Maybe i am just not doing it
> right.
> I have my macro with "Runcode" and "=Import()" in the argument and the
> code
> in the module1 as:
>
> Private Function Import()
> On Error Resume Next
> DoCmd.SetWarnings False
> DoCmd.DeleteObject acTable, "AdjLiveRpt"
> DoCmd.TransferText acImport, "AdjLiveRpt", "AdjLiveRpt", "File.txt",
> True
> DoCmd.SetWarnings True
> End Function
>
> But it still give error "Expression entered has a function name Office
> can't
> find". Any Ideas?
>
> "Steve Schapel" wrote:
>
>> Sverre,
>>
>> You don't include the name of the Module in the RunCode macro. I
>> suggest to write the code as a function, in other words you can simply
>> change the first line of the procedure to:
>> Public Function Import()
>> .... and the last line to:
>> End Function
>>
>> And then in the RunCode macro:
>> =Import()
>>
>> --
>> Steve Schapel, Microsoft Access MVP
|