way to use VBA function in query/report?

kelsita_05

Registered User.
Local time
Today, 10:40
Joined
Aug 23, 2005
Messages
52
Hi-

I have consultant names saved as Last, First in my database.

I have a VBA function that I use to switch the name order, so when I automatically generate an email using VBA, it says "Dear First Name." It works great.

Now, I need to get some of the information into a PDF, rather than an email. I've created a query, then based a report on it that looks beautiful, but I can't figure out how to do the name switch operation. So my report says "Dear last name, first name." Less than ideal.

Is there a way to either use my VBA function in the query/report to isolate the first name? or, alternatively, how do I change my code to generate a PDF instead of an email?

I inherited the database, so I didn't do all the coding myself, and some of it is a little over my head. I can provide samples/SQl statements, whatever would be helpful.

Thank you very much!:o
 
Your function :

  • needs to be public
  • in a standard module (ease more than essential I think)
Assuming it's used like this: fYourNameReverse("Someone, Kalista")
in the query it would be
PHP:
Select fYourNameReverse([TableNameField]) As FullName from yourtable;
or in the query builder
PHP:
FullName: fYourNameReverse([TableNameField])
 
worked beautifully. Thank you ever so much for your assistance!!!!!
 
Pleasure
You should really be storing Names as FirstName LastName then you would not end up having to write functions ALSO

Order by firstname or lastname becomes easier
 
Yes, separate fields for First, Last, and Middle names - it is much easier to bring them together than to break them apart.
 

Users who are viewing this thread

Back
Top Bottom