microsoft training access course - procedures

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » microsoft training access course - Procedures

microsoft training access course - Procedures

resolvedResolved · Low Priority · Version Standard

Gerry has attended:
Access VBA course

Procedures

On a form I have some code behind the 'on update' event procedure to change the case format of the entered text. The field is DoctName

if not isnull(DocName) then
DocName = Strconv(DocName,vbProperCase)
end if

I want to put this code behind other fields on the form but of course with the correct field name. Can I create a procedure and then call the procedure from the 'on update' for each relevant field on the form. If so how can I refer to the field name (which will of course change) in the procedure.

RE: Procedures

Yes you can by creating a procedure for instance


but may I suggest in the interest of simplicity you use the

ucase function

me.docname = UCase(me.docname.value)
just change the field name as appropriat e
if null is passed no error occurs - null is returned thus eliminating a needless check



ALTERNATIVELY SHOULD YOU WISH A GENERIC PIECE OF CODE
code
sub ChangeToU_Case( frmName as string , txtBoxName as string)


forms!frmname!txtBoxName.value = ucase(forms!frmname!txtBoxName.value)
forms!frmname.refresh
end sub
/code
CONTINUE.......
----------------------

on each of the after update EVENTS OF YOUR FIELDS
ChangeToU_Case(me.name & " " & Me.Text0.Name)

Replace the Text0 with the names of the fields on which you wish to implement the code

**********************************************
NB *****
CHECK BEFORE RUNNING AS I AM IN 2007 AND THINGS HAVE CHANGED MIGHTILY

jO

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Remove spaces in a table

If you have a table that has too many space marks littered around, you can create a update query and use the trim function to get rid of any excess space marks

View all Access hints and tips


Server loaded in 0.08 secs.