arnelgp
..forever waiting... waiting for jellybean!
- Local time
- Today, 15:08
- Joined
- May 7, 2009
- Messages
- 20,190
Once again, thank you for the help. I think what I am going to end up doing is just run with opening the Report up with all showing. However I tested your one sample I think you posted in Post #12. What is weird this is doing what I need, however I uploaded our actual file that I would be using and it has a total of 32 trucks on it (sometimes this can go up to as high as 35. It has a total record count in the tblMain of 486 which isn't a lot. When I try to open the report, it gives an error saying Query is too complex. When I delete the last truck (truck 32 and those records tied to it) it seems to open up just fine. I know before I just had about 6 trucks or so, but our truck list is like below. I initially had the wrong TruckID on there, which I figured out that part of it all. Now just need to see why the query is too complex with this much of an actualy query maybe?here also with Filter.
you can run form1 for this demo that will filter the report on
DeliveryDate = Oct 13, 2022.
you can create any filter on it.
that is ok.I unfortunately can't post the new copy with all the data as it does actually contain real customer information
I actually had tried this, when this code is in place or not and if I have a 10 digit or more number in the field, that whole row is blank on my report. I have it set to allow to grown and shrink to yes and as well as to no, so not sure why it's being dumb. I don't think I have any validation in place to meet length requirements either. I'm lost hahaSome solutions here
shrink to fit
I know the property exists in Excel, but can I shrink the font of a control depending on the size of the text, while keeping the control the same size?? TIA, Sparxwww.access-programmers.co.uk
I can try and get a screenshot of it and upload it. What's weird is I can get that code to work for a different field, but for some reason that field won't adjust the font size when equal to 18 or greater than 9 etc..Grow and shrink deals with the height, so you want that set to false. If not it will throw off the number of blank rows required. Can you post an example so we can see the issue?
Private Sub Report_Open(Cancel As Integer)
Dim sql As String
Dim record_count As Long, record_fill As Long
With CurrentDb.OpenRecordset("TruckCount", dbOpenSnapshot, dbReadOnly)
If Not (.BOF And .EOF) Then
.MoveFirst
End If
Do While Not .EOF
record_count = 0: record_fill = 0
sql = sql & _
IIf(Len(sql) <> 0, " UNION ", "") & _
"select * from TruckLogQry where TruckID = '" & !TruckID & "'"
record_count = !Kount
If record_count < MAX_LINES Then
record_fill = MAX_LINES - record_count
Else
If record_count > MAX_LINES Then
record_fill = record_count Mod MAX_LINES
End If
End If
If (record_fill <> 0) Then
sql = sql & " UNION " & _
"select top " & record_fill & " " & _
"id," & _
"'" & !TruckID & "'," & _
99999 & "," & _
"Null," & _
"Null," & _
"Null," & _
"Null," & _
"Null," & _
"Null," & _
"Null from dummy"
End If
.MoveNext
Loop
.Close
End With
'Debug.Print sql
Me.RecordSource = sql
End Sub
Ok, I am an idiot sorry, I saw the correct info. One thing I am getting an error now trying to open the report Truck Log it gives a parameter error asking for tblMain.TruckID which is a valid field.if you have many trucks, the Union query will fail.
see post #24 for Temp table solution.