Go Back   Access World Forums > Apps and Windows > VB.NET

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 01-05-2017, 07:04 AM   #1
aarontassell
Newly Registered User
 
Join Date: Jan 2017
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
aarontassell is on a distinguished road
subject line

I am trying to create a validation rule that will require the 1st 10 characters of a subject line in outlook to be formatted in the following format:
1st two characters are numbers, 3rd character a hyphen characters 4-7 numbers, 8th character hyphen, last two characters numbers Example (10-2356-00)
I found the validation rule below but not sure how to modify line 4 to accomplish my need. Any assistance would be greatly appreciated.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim strSubject As String
strSubject = Item.Subject
If Len(Trim(strSubject)) >99-9999-99aaaaaa;;_
Prompt$ = "Reminder. Are you sure you added the job number?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + _
vbMsgBoxSetForeground, "Check for Subject") = vbNo Then
Cancel = True
End If
End If
End Sub

aarontassell is offline   Reply With Quote
Old 01-05-2017, 05:21 PM   #2
CJ_London
Super Moderator
 
Join Date: Feb 2013
Location: UK
Posts: 9,620
Thanks: 37
Thanked 3,116 Times in 3,025 Posts
CJ_London is a jewel in the rough CJ_London is a jewel in the rough CJ_London is a jewel in the rough
Re: subject line

surely you just want to know that the various characters are numbers or hyphens in the right places

if so then I would think this should do it

If not (Trim(strSubject) like "##-####-##*") then Prompt$ = "Reminder. Are you sure you added the job number?"
__________________
CJ_London
_______________________
A little thanks goes a long way. If you have found this post useful, please tick the thanks button
CJ_London is online now   Reply With Quote
The Following User Says Thank You to CJ_London For This Useful Post:
sneuberg (01-06-2017)
Old 01-06-2017, 06:53 AM   #3
aarontassell
Newly Registered User
 
Join Date: Jan 2017
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
aarontassell is on a distinguished road
Re: subject line

Worked perfectly, thank you

aarontassell is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add data to email subject line DMerchen Macros 0 05-08-2014 10:44 AM
Having 2 fields in an e-mail subject line ledmark Forms 2 04-06-2011 12:38 PM
Add A Name To Report Subject Line Learn2010 Reports 1 01-12-2011 08:20 AM
Populating subject line of email ckitzman Reports 0 10-04-2006 06:29 AM
Boldfacing a subject line in e-mail greaseman Modules & VBA 2 07-31-2003 09:28 AM




All times are GMT -8. The time now is 04:27 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World