UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Scheduled Task That Runs Macro - Change Text Color, Access 2013    
 
   
krosal
post May 13 2020, 07:00 PM
Post#1



Posts: 65
Joined: 22-October 18



I currently have a scheduled task that runs the code which adds record to my form based on Daily, Weekly, and Monthly timing. The query is 'Run Code' based on the following code.

My question is 'Can I make a group for 'Due_Date' ie; Daily, Weekly, and Monthly', and have it be a different text color?

This equals a month in the code below ( rs.Fields("Due_Date") = Now() + 24 ) .




Public Sub AddRecordsetWindowsUpdates()
Dim i As Integer
Dim db As Database
Dim rs As Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_Tasks")


rs.AddNew
rs.Fields("Title") = "Windows Updates"
rs.Fields("Due_Date") = Now() + 24
rs.Fields("Description") = "Windows Updates are approved for installation on the 2nd Tuesday of every Month"
rs.Fields("Category_ID") = 1
rs.Fields("Contact_ID") = 1
rs.Fields("Status_ID") = 1
rs.Fields("Priority_ID") = 1
rs.Fields("Assignedby_ID") = 1


rs.Update

rs.Close
Set rs = Nothing
db.Close

End Sub



Thank you,
Go to the top of the page
 
MadPiet
post May 13 2020, 07:19 PM
Post#2



Posts: 3,788
Joined: 27-February 09



You wouldn't do that in a macro. You'd use conditional formatting of your controls in your form.
Go to the top of the page
 
krosal
post May 14 2020, 05:15 AM
Post#3



Posts: 65
Joined: 22-October 18



I wasn't thinking of a macro to accomplish this, and thought that possibly adding it to the code would maybe work. Conditional formatting on the controls in the form does sound good, I'll see if I can figure this out.

Thank you
This post has been edited by krosal: May 14 2020, 05:16 AM
Go to the top of the page
 
krosal
post May 14 2020, 06:40 PM
Post#4



Posts: 65
Joined: 22-October 18



I have a little problem with changing the color since the form data is in a list box. I found that you can do this by entering vba code in the 'After Update' event. The problem that I have is that the list box 'After Event' is already being used with assigned code. Is there another event that I could use? Or can I add it on to the existing code?

Private Sub ListIncomplete_AfterUpdate()
Dim rs As Object
Dim lngTimeID As Long
Dim lngTaskID As String

lngTimeID = Me.ListIncomplete.Column(0)
lngTaskID = Me.ListIncomplete.Column(1)

Me.Requery

Set rs = Me.RecordsetClone
With rs
.FindFirst "taskid=" & lngTimeID
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With

End Sub

Thank you,
This post has been edited by krosal: May 14 2020, 06:41 PM
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    9th July 2020 - 03:11 AM