=FIND("text","this is the text to search",1) / DoCmd.TransferText

G

Guest

sorry, this is probably really basic, but I left my vba book at home and couldn't find it in the help menu

all i want to know is how to check a variable which holds a string and see whether it holds 'text' or not... ie., something like this in excel
=FIND("text","this is the text to search",1

Actually.. try that one, or expand
I have the following script

DoCmd.TransferText acImportDelim, mySpec, myTable, myFile, True, "

which works and imports a text file.. but i can also import 'myFile' if the headings do not match that of 'myTable'. I just wanted to add a check on the file name to see it was the right file. But it could be to insist that the above command works only when headings match would be even better?

thanks for your ideas
Marcus
 
J

John Vinson

all i want to know is how to check a variable which holds a string and see whether it holds 'text' or not... ie., something like this in excel:
=FIND("text","this is the text to search",1)

The analogous function in Access is InStr:

If InStr("text", "this is the text to search") > 0 Then
<the text was found>
Else
<it wasn't>
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top