VB Syntax Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I'm using the module below and it's getting a syntax error. I've tried a
few things but it didn't fix it. I even tried commenting out every line
exept one and still a syntax problem. Can someone tell me what's wrong?
Thanks,
Ronda
 
Ronda said:
Hi,
I'm using the module below and it's getting a syntax error. I've
tried a few things but it didn't fix it. I even tried commenting out
every line exept one and still a syntax problem. Can someone tell me
what's wrong?

Answering this sort of question is always a lot easier if you report the
exact error message you're getting. If you're trying to run this code
in Access, I'd also expect the faulting line to be highlighted when the
error is raised. *Are* you running this in Access?

That said, I can't help noticing the line:
strOut = strOut & " " & Trim(Left(YourField,
Instr(1,Yourfield,",") -1))

Nowhere else does the code mention anything called "YourField". That
looks like an example name. Should it perhaps be "sNameIn" instead?
 
Yes I fixed that, but I put what I started with here and forgot to change it.
I have it in a Module, and I have an Access query that will use it. I'm not
a VB user so I may be describing it incorrectly. The error says: There was
an error compiling this function. The Visual Basic module contains a syntax
error. Check the code, and then recompile it. But it doesn't highlight
anything.
Thanks for any help!
 
Geez I just figured it out. I had opened another Module and decided not to
use it and just left it there. Since I wasn't calling it I didn't think it
would be a problem, but that's what it was. I had to remove it and then it
worked (along with another change to the Trim line). Thanks so much Dirk for
helping me!
Ronda
 
Ronda said:
Geez I just figured it out. I had opened another Module and decided
not to use it and just left it there. Since I wasn't calling it I
didn't think it would be a problem, but that's what it was. I had to
remove it and then it worked (along with another change to the Trim
line). Thanks so much Dirk for helping me!

You're welcome, but it seems you helped yourself. Well done.
 

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

Back
Top