Doreen-
As you've discovered, the Validation Rule won't trigger unless the user
"dirties" the field. You'll have to add code to your buttons to verify the
initials before performing any other action.
If IsNull(Me.cmbInitials) Then
MsgBox "You must enter your initials."
Me.cmbInitials.SetFocus
Exit Sub
End If
As for the email address, you can make the field a Hyperlink data type, but
you'll need to add code to fix the Hyperlink. The problem is in the absence
of a protocol header (http://, ftp://, mailto: ...) a Hyperlink field always
inserts http:// - which won't work for an email address. Code in
AfterUpdate of the control will fix it:
Private Sub EmailName_AfterUpdate()
' If you just type in an email name: [EMAIL PROTECTED]
' Access changes it to: [EMAIL PROTECTED]://[EMAIL PROTECTED] !!
' This code tries to fix it
Dim intI As Integer
' Don't do anything if email is empty
If IsNull(Me.EmailName) Then Exit Sub
' Fix up http:// if it's there
Me.EmailName = Replace(Me.EmailName, "http://", "mailto:")
' Now look for the first "#" that delimits the hyperlink display name
intI = InStr(Me.EmailName, "#")
' And put the person name there instead if found
If intI > 0 Then
Me.EmailName = (Me.FirstName + " ") & Me.LastName &
Mid(Me.EmailName, intI)
End If
End Sub
John Viescas, author
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
Running Microsoft Access 2000
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
For the inside scoop on Access 2007, see:
http://blogs.msdn.com/access/
_____
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of rokkeee
Sent: Friday, June 16, 2006 3:45 PM
To: [email protected]
Subject: [ms_access] mandatory login for user
I have a Main form that opens with the database and the cursor is in
the combo box where the users can either choose their initials from
the list or type them in. I want this to be mandatory before they can
click on another other buttons to continue. Right now, I have a
validation rule setup on that login box, but it only works if they
populate that field then clear it. I want it to be mandatory from the
get go. How can I do that?
And on another note, how do I make the email address in a message box
a hyperlink that when clicked will automatically open outlook to send
a message to that person?
Doreen
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/q7folB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ms_access/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/