Complicated conditional formatting? (1 Viewer)

Just1

Registered User.
Local time
Today, 15:05
Joined
Jan 9, 2005
Messages
50
In one of my forms I have a date field. I have a macro button to send that date to appear on an Outlook task.

Is it possible for my date field to appear in different coloured text once the macro button has been pressed, so that I know it's been sent and don't send it twice?

Now I know that for most of you experienced users out there, you would probably just make my macro do a loop?? so that all dates from the database reach Outlook, but I'm so new to this that the above method seemed possibly easier?!

Any ideas? Oh, here is the code used for my macro - so if anyone can tell me how and where I add code to loop this, please let me know!!!

Private Sub cmdOutlookRem_Click()
Dim OutlookApp As Outlook.Application
Dim OutlookTask As Outlook.TaskItem
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookTask = OutlookApp.CreateItem(olTaskItem)
With OutlookTask
.Subject = "Contact " & Me!Forename & " " & Me!Surname & ", " & Me!CompanyName
.Body = "Company Tel No: " & Me!CoTelNo & ", " & "Direct Line: " & Me!DirectLineinCo & ", " & "Mobile: " & Me!MobileNo
.ReminderSet = True
.ReminderTime = DateAdd("n", 2, Me!DateNextContact) 'Remind 2 minutes from now.
.DueDate = DateAdd("n", 5, Me!DateNextContact) 'Due 5 minutes from now.
.StartDate = DateAdd("n", 2, Me!DateNextContact)
.ReminderPlaySound = True
.ReminderSoundFile = "C:\Windows\Media\Ding.wav" 'Modify path.
.Save
End With
End Sub
 

RichO

Registered Yoozer
Local time
Today, 17:05
Joined
Jan 14, 2004
Messages
1,036
Because conditional formatting is dependant on the values of specified fields, you would have to change the value of one of the fields within that record upon the click of the button. If this is how you want it to work, I would simply add a boolean field to your table where you can change the value of that field when the button is clicked. Then use that field as the condition for changing the color of your date field. Or....

As far as looping the code goes, it can be easily done. Are you wanting to send the date from ALL records on the form? I'm assuming this is a continuous form you are using? It's rather simple (once you know how to do it) to loop through the form's recordset. If that's what you want to, post a reply and I'll shoot you an example.
 

Just1

Registered User.
Local time
Today, 15:05
Joined
Jan 9, 2005
Messages
50
Hi - thanks for reply. I'll have a go at the boolean thing! (New to this so had to look it up!). But in an ideal world, one button will send the dates from all the records to Outlook so if you can help me with the loop that would be great. Where do I put it in my code?

Incidentally, my form shows a single record at a time and isn't a continuous form. I could change it if it makes a difference.

Thanks
Just1
 

RichO

Registered Yoozer
Local time
Today, 17:05
Joined
Jan 14, 2004
Messages
1,036
In order to know which records to send to Outlook, there has to be some way to select them or filter them. That is unless you want every record in the table sent to Outlook.
 

Users who are viewing this thread

Top Bottom