MakinBacon91
New Member
- Joined
- Sep 8, 2015
- Messages
- 47
Hello All,
I have a report that is grouped by JobID,
I would like to add some VBA that will format a text box in each group section.
I want a text box that will dynamically display a "Priority Date"
This Priority date will be different for each job or nonexistent.
I want to check this JobDate table, and then set the "Priority Date" to the available date, or leave it blank.
<caption> JobDate </caption><thead>
</thead><tbody>
</tbody><tfoot></tfoot>
I am fairly good with vba, but I do not know how to perform this check for each item in the group (each JobID).
Here is a little bit of the code I am working on:
I just don't know where to put my code so that it will run every time a new item is formed in the group.
Let me know if I can clarify anything.
Thanks!
-Bacon-
I have a report that is grouped by JobID,
I would like to add some VBA that will format a text box in each group section.
I want a text box that will dynamically display a "Priority Date"
This Priority date will be different for each job or nonexistent.
I want to check this JobDate table, and then set the "Priority Date" to the available date, or leave it blank.
JobID | SendS&I | CompletePre-Coat | ShipDate |
---|---|---|---|
DUK-1501 | 11/30/2015 | ||
DUK-1502 | 12/11/2015 | ||
DUK-1503 | 12/11/2015 |
<caption> JobDate </caption><thead>
</thead><tbody>
</tbody><tfoot></tfoot>
I am fairly good with vba, but I do not know how to perform this check for each item in the group (each JobID).
Here is a little bit of the code I am working on:
Code:
Dim str_jobID As String, str_SQL As String, rs As Recordset, str_return As String
str_jobID = Me.GroupLevel(1).ControlSource
str_SQL = "SELECT JobDate.JobID, JobDate.[SendS&I], JobDate.[CompletePre-Coat], JobDate.ShipDate FROM JobDate WHERE (((JobDate.JobID)=" & str_jobID & "));"
Set rs = CurrentDb.OpenRecordset(str_SQL)
If rs("SendS&I") > "" Then
str_return = "SendS&I"
ElseIf rs("CompletePre-Coat") > "" Then
str_return = "CompletePre-Coat"
ElseIf rs("ShipDate") > "" Then
str_return = "ShipDate"
Else
str_return = " "
End If
txt_priorityDate.ControlSource = str_return
txt_jobID.ControlSource = str_jobID
I just don't know where to put my code so that it will run every time a new item is formed in the group.
Let me know if I can clarify anything.
Thanks!
-Bacon-