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

microsoft training access course - procedures

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

microsoft training access course - Procedures

ResolvedVersion 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:

Related tables

When you have related tables such as Customers and their Orders, the Customer table is the Primary table.

Open the Customers table in datasheet view and go to the Home Tab and Records group. Click on the More option and choose Subdatasheet and then click on Subdatasheet again. Now choose the related table (Orders) and click ok.

Now you can click the + symbol by each company to show the related orders.

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.