WhiskyLima
Registered User.
- Local time
- Today, 23:29
- Joined
- Oct 8, 2013
- Messages
- 48
Hey guys, I have a form with 2 sub forms in it. The first form is on the top and holds bookings and the second is under that and holds invoices. I have made it so that each time an invoice or a booking is added or removed, the code below runs to change the height of each sub form relative to the number of records in it, in order to keep the page looking concise and tide.
Now I should mention that this was previously working fine and suddenly does not. Now when I create a new booking or invoice, nothing happens to the height. If I delete one, that works and if I close and reopen the form, it corrects the height there too as the function is also called in the onload. It seems to be an issue with the record count as it is not finding the correct number of records.
Any help would be greatly appreciated
Now I should mention that this was previously working fine and suddenly does not. Now when I create a new booking or invoice, nothing happens to the height. If I delete one, that works and if I close and reopen the form, it corrects the height there too as the function is also called in the onload. It seems to be an issue with the record count as it is not finding the correct number of records.
Code:
Function dynamicHeight()
'Change the height and top position of each subform dynamically
'based on the number of records in each subform.
Dim numRec As Integer
Dim recHeight As Integer
Dim minHeight As Integer
Dim totalHeight As Integer
minHeight = 1077
recHeight = 566
'First resize the booking windows
numRec = [Forms]![SAEvent]![SABookings].Form.RecordsetClone.RecordCount
totalHeight = minHeight + (numRec * recHeight)
[Forms]![SAEvent]![SABookings].Height = totalHeight
'Then the invoices position and height depending on the size of the bookings subform
[Forms]![SAEvent]![SAInvoices].Top = [Forms]![SAEvent]![SABookings].Top + totalHeight + 400
numRec = [Forms]![SAEvent]![SAInvoices].Form.RecordsetClone.RecordCount
totalHeight = minHeight + (numRec * recHeight)
[Forms]![SAEvent]![SAInvoices].Height = totalHeight
End Function
Any help would be greatly appreciated