klsblues
Member
- Local time
- Today, 11:37
- Joined
- Aug 2, 2023
- Messages
- 48
Hi MajP,The big problem is still that the grid only shows and allows you to add edit a job once that job has 1 scheduled event. The better solution is to do an outer join and show all jobs. I have not played with that. In the short term you might want a button on this form to "add" a job without an event. That would take you to the jobDetailsForm.
FYI the xtab by itself is actually meaningless. The code does not use the stored query but builds a new query each time via code. To demonstrate you can change that query into anything like a simple select. Then run the Grid. So there is not reason to add or edit it. It will not be used.and then add that query into my Xtab query
It would mean changing the current query that is written in code, since as stated above changing the stored query does nothing. If you make an outer join between Table A and Table B then it shows all records in A and matching records in B. An inner join only shows records in A with a match in B. You currently have an inner join. If instead you had an outer join from Jobs to schedule you will get all the jobs and matching schedules. Turning this into a crosstab with a forced set of columns would give you all the jobs as rows in the grid regardless if they have any associated schedules.I take your point about the non-scheduled jobs - I hadn't thought about that. Does that mean that I have to make another query first to get all the jobs (scheduled or not) and then add that query into my Xtab query and then add that into the SQL part of the code?
Hi MajP. I'll take a look next week and see what I can do.Actually that is not going to work. That row will not show in a crosstab because there is no value in a column. Different than a select.
In the short term have a button on the header to "Add Additional Jobs". This will pop up the Schedule Detail.
You could get a little slicker and have a combobox with all jobs not in that period. Then the user can select a job and then click one of the Day labels. If would open the detail schedule to that job and default the day information like it currently does.
On that not you might want to add a Note in the header or footer (Double click grid cells to add / edit time information)
Hi MajP,Here is a demo to add jobs not currently listed.
I am confused since you already are doing this with conditional formatting. That is the proper way to do it, so not sure what different result you are looking for.I have been trying to work out how to use VBA to set the colour of the field background. I created a table to store the users choices of colours, tried using a tempVars to set the colours using the colourNumber field from the colours table and then tried using IF, Then to format the JobStatus Field depending on the status number (i.e. If me.jobStatus = 1 then me.jobstatus = "Tempvars", but to no avail. is this something that can be done?
The end user has asked me the question, “what if I want to pick my own colours or add another status and apply a colour to that status as you won’t be around forever to add the conditional formatting!”I am confused since you already are doing this with conditional formatting. That is the proper way to do it, so not sure what different result you are looking for.
I have added the TempVars and the rest of the code to OnLoad of the frmGrid, but it errors.The end user has asked me the question, “what if I want to pick my own colours or add another status and apply a colour to that status as you won’t be around forever to add the conditional formatting!”
PMFJI but "Tempvars" means you are setting it to that word, not the tempvar which anyway would be TempVar!YourName.Value or TempVar("YourName").ValueI am confused since you already are doing this with conditional formatting. That is the proper way to do it, so not sure what different result you are looking for.
If me.jobStatus = 1 then me.jobstatus = "Tempvars"
Hi Gasman,PMFJI but "Tempvars" means you are setting it to that word, not the tempvar which anyway would be TempVar!YourName.Value or TempVar("YourName").Value
Plus you need to mention the BackColor property?
So
means if the status is 1 make it "TempVar". If the status is numeric, which it appears to be that is never going to work.Code:If me.jobStatus = 1 then me.jobstatus = "Tempvars"
Hi Gasman,I would be debug.print(ing) the Colour0x to see if they have been formatted correctly.
I would also be using a Select Case statement instead of all those Ifs.
Learn to walk your code, set breakpoints and inspect/debug.print variables/controls values.
You could also test those statements in the immediate window.
Sub SetBC()
Dim iRed As Integer, iGreen As Integer, iBlue As Integer
iRed = 235
iGreen = 12
iBlue = 5
Me.cboDates.BackColor = RGB(iRed, iGreen, iBlue)
End Sub
StatusID | StatusDescription | BackColor | BackcolorDescription | ForeColor | ForecolorDescription |
---|---|---|---|---|---|
1 | Not Allocated | 255 | Red | 0 | Black |
2 | Allocated | 33023 | Orange | 0 | Black |
3 | Complete | 32768 | Green | 0 | Black |
4 | Cancelled | 16711680 | Blue | 16777215 | White |
Public Sub ClearFormatConditions()
Dim con As FormatCondition
For Each con In Me.JObStatus.FormatConditions
con.Delete
Next con
End Sub
Public Sub ApplyFormatConditions()
Dim con As FormatCondition
Dim rs As DAO.Recordset
Dim Status As Long
Dim BackColor As Long
Dim ForeColor As Long
Set rs = CurrentDb.OpenRecordset("tblStatus")
Do While Not rs.EOF
Status = rs!StatusID
BackColor = GetBackcolor(Status)
ForeColor = GetForeColor(Status)
Debug.Print BackColor & " " & ForeColor
Set con = Me.JObStatus.FormatConditions.Add(acExpression, , "[jobStatus] like " & Status)
With con
.ForeColor = ForeColor
.BackColor = BackColor
End With
rs.MoveNext
Loop
Me.Refresh
End Sub
Do you want 1 combo with all 15 minute choices (i.e. 12:00 am 12:15 am, .... 11:30 Pm, 11:45 pm)? I would think, that would be a lot of choices to scroll through. Does not make it easier. However that could be done without a pop up form. Or do you want two combos, hours (12 Am, 1 AM, 2 AM .... 11 pm) and minutes (00,15,30, 45)I have been asked if the time picker could be a simple combo box which drops down to show the15 minute incremented times and when OK is clicked,