Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to call modules from Before Update Event

Status
Not open for further replies.

sempuritoza

Programmer
Jul 16, 2003
12
0
0
ZA
hi there

well i have a module that i created
"ValidateString(y as string)" now i need to call this module on the Before Update event. i thought that i would go to the Macro1 under the Before Update Event and use the openModule action and then just put the field name i.e. "Me.fieldname" in the brackets calling the function but that doesnt seem to be working.

can somebody plz tell me what it is that i am doing wrong,
all help would be appreciated

lata
E
 
I take it your ValidateString function returns true or false. If so I would do the following:

1. On the Access form, select [Event Procedure] for the Before Update event and press the build button (...)

2. In the before update event, put the following (substitute txtField for the name of a control on your form that you want to validate)

'=============================
If ValidateString(txtField) = False then
Msgbox "Invalid text"

'Cancel the update
Cancel = True
End If
'===============================

Cheers

Iain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top