NearImpossible
Registered User.
- Local time
- Today, 01:24
- Joined
- Jul 12, 2019
- Messages
- 225
Form opens, but the subform doesn't display correctly
I have inherited a ticket tracking database, where when a ticket is created, you can specify if a piece of equipment has been tagged for a RMA and it generates a RMA form for that piece of equipment.
This issue is a RMA form is generated for every piece of equipment, whether it was identified as a RMA or not.
I've narrowed it down to the following bit of code:
[RMA Transfer] is a checkbox tied to a linked table from SQL with its Data Type as bit
This runs and the Facilities form opens to the correct facility and shows all tickets in a subform, however using the "varX=true" is being ignored as it returns as a -1 or 0 so even though the "OpenForm" line works correctly and displays all tickets, a RMA report is generated even though equipment wasn't marked for a RMA
If I change the code from above to
Everything runs correctly and only generates the RMA form if a piece of equipment was marked for a RMA, but now for some reason, the Facilities form opens to the correct facility, but only 1 blank record is displayed in the subform vs showing all the records. If I close the Facilities form and reopen it, all tickets are displayed in the subform correctly.
All tickets should always be displayed in the subform whether a device was marked for RMA or not, the only thing this is doing is generating a RMA form when a device is selected for a RMA.
Any suggestions as this doesn't make any sense to me as nothing else changed other than changing from the varX=true to checking if the [RMA Transfer] = -1? If I put the varX stuff back in, the subform once again displays correctly
I have inherited a ticket tracking database, where when a ticket is created, you can specify if a piece of equipment has been tagged for a RMA and it generates a RMA form for that piece of equipment.
This issue is a RMA form is generated for every piece of equipment, whether it was identified as a RMA or not.
I've narrowed it down to the following bit of code:
[RMA Transfer] is a checkbox tied to a linked table from SQL with its Data Type as bit
Code:
Dim varX As Variant
varX = DLookup("[RMA Transfer]", "dbo_nFacilityTicketEquipment", "[TicketID]= " & Me.TicketID)
If varX = True Then
[INDENT]<NoMacro runs>
DoCmd.OpenForm "Facilities", , , "[FacilityID]= " & Me.[FacilityID], , , "ticket"[/INDENT]
else
[INDENT]<YesMacro runs>
DoCmd.OpenForm "Facilities", , , "[FacilityID]= " & Me.[FacilityID], , , "ticket"[/INDENT]
End if
This runs and the Facilities form opens to the correct facility and shows all tickets in a subform, however using the "varX=true" is being ignored as it returns as a -1 or 0 so even though the "OpenForm" line works correctly and displays all tickets, a RMA report is generated even though equipment wasn't marked for a RMA
If I change the code from above to
Code:
If DLookup("[RMA Transfer]", "dbo_nFacilityEquipment", "[TicketID]= " & Me.TicketID) = "-1" Then
[INDENT]<YesMacro runs>
DoCmd.OpenForm "Facilities", , , "[FacilityID]= " & Me.[FacilityID], , , "ticket"[/INDENT]
else
[INDENT]<NoMacro runs>
DoCmd.OpenForm "Facilities", , , "[FacilityID]= " & Me.[FacilityID], , , "ticket"[/INDENT]
End if
Everything runs correctly and only generates the RMA form if a piece of equipment was marked for a RMA, but now for some reason, the Facilities form opens to the correct facility, but only 1 blank record is displayed in the subform vs showing all the records. If I close the Facilities form and reopen it, all tickets are displayed in the subform correctly.
All tickets should always be displayed in the subform whether a device was marked for RMA or not, the only thing this is doing is generating a RMA form when a device is selected for a RMA.
Any suggestions as this doesn't make any sense to me as nothing else changed other than changing from the varX=true to checking if the [RMA Transfer] = -1? If I put the varX stuff back in, the subform once again displays correctly
Last edited: