Need help in VBA Codes

B

BruceM

What you really need to do is to believe me when I say this is outside the
area on which I can effectively advise you. The other thing you need to do
is to include the rest of the thread in your reply to whoever responds. My
suggestion about the unbound text box was a bit of a guess, as I clearly
admitted. However, I can suggest something, which is to test whether the
GetAbbrevs value has any meaning in your code. You say that you have a text
box that has the code, but you refer to it in your description variously as
CODE and as txtCode. You go on to say that you have a text box that has the
code, but does it? First, make the text box Me.Code visible for now. You
can always hide it later. Next, in the form's Current event, put Me.Code =
GetAbbrevs. That's all. If you are getting the expected result in the text
box, then you can proceed with other experiments. If not, that's where you
need to start. If no go, I would within the GetAbbrevs function define the
result as a string (strAbbrev, or whatever), then I would (still within the
function) add a message box line of code: msgbox strAbbrevs. Call the
function from a command button, and see if you get the expected result in
the message box. If so, then you can get rid of the message box and try
passing the string (not the function name) to your code.

Better yet, start a new thread entitle something like Passing Function to
Query. Then, add the code you found to parse the text and extract the first
letter of each word. Include the statement about calling the function from
a query, and ask what that means. If you can get the result in a query it
would be a cleaner method than to use a hidden text box.

Whenever you are trying to define something like the result you are
expecting GetAbbrevs, test for the expected result by means of a message box
or text box or something before you write the rest of the code. I still
think the problem is that GetAbbrevs has no meaning in the context of an
event on the form.
 
F

FA

Thanks Bruce, its working now all i did was took out Me.Newrecord from
the code because its not a new record. Its working fine now. Thanks
again and sorry that i kept asking you. Next time i will listen to you
;-)

Thanks again

Moe
 
B

BruceM

Just be aware that the number will change if the user clicks the command
button. If you want the number to be a permanent part of the record, you
should probably disable or hide the command button except for new records,
or something of that sort.
 
B

BruceM

Just be aware that the number will change if the user clicks the command
button. If you want the number to be a permanent part of the record, you
should probably disable or hide the command button except for new records,
or something of that sort.
Glad it's working. Good luck with your project.
 

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