Originally Posted by
ssanfu
Do you have these 2 lines as the first two lines of
EVERY module?
Code:
Option Compare Database
Option Explicit
Yes, to the Option Compare Database
Most of them for the Option Explicit
Below is the code for the button.
Code:
Private Sub Command321_Click()
Dim smlt As String
Dim strDocument
Dim dbs As Database
Dim rst As Recordset
Dim strSelect As String
Dim records As String
Dim qdf As QueryDef
Set dbs = CurrentDb
strSelect = ("SELECT* FROM qryDoorCalc3 WHERE [ordid] = " & Me.OrdId & "")
'view recordset in query
Set rst = dbs.OpenRecordset(strSelect, dbOpenSnapshot)
If rst.EOF Then
Exit Sub
Else
rst.MoveFirst
Do While Not rst.EOF
If rst!OrdId = Me.OrdId And rst!GlOenL > (rst!RawL / 2) And rst!GlOpenW > (rst!RawW / 2) And rst!ProdId = 4101 Then
strDocument = "Door Listing Full Lite"
DoCmd.OpenReport strDocument, acViewPreview, , "([ordid]=" & rst!OrdId & ") And ( Not [CORE]= """ & "LBR" & """) And (Not[smltdoor]is not null)"
Else
If rst!SmLtDoor = "Small Light Door" And rst!OrdId = Me.OrdId And rst!GlOenL < (rst!RawL / 2) And rst!GlOpenW > (rst!RawW / 2) And rst!ProdId = 4101 Then
strDocument = "Door Listing Half Lite"
DoCmd.OpenReport strDocument, acViewPreview, , "([ordid]=" & rst!OrdId & ") And ([smltdoor]= """ & rst!SmLtDoor & """)"
Else
If rst!OrdId = Me.OrdId And rst!GlOenL > (rst!RawL / 2) And rst!GlOpenW < (rst!RawW / 2) And rst!ProdId = 4102 Then
strDocument = "Door Listing R Side Lite Long"
DoCmd.OpenReport strDocument, acViewPreview, , "([ordid]=" & rst!OrdId & ")"
Else
If rst!OrdId = Me.OrdId And rst!SmLtDoor = "Small Light Door" And rst!GlOpenW < (rst!RawW / 2) And rst!ProdId = 4102 Then
strDocument = "Door Listing R Side Lite"
DoCmd.OpenReport strDocument, acViewPreview, , "([ordid]=" & rst!OrdId & ") And ([smltdoor]= """ & rst!SmLtDoor & """)"
Else
If rst!Core = "LBR" And rst!OrdId = Me.OrdId Then
strDocument = "door listing solid wood"
DoCmd.OpenReport strDocument, acViewPreview, , "([ordid]=" & rst!OrdId & ")And ([CORE]= """ & rst!Core & """)"
Else
If rst!OrdId = Me.OrdId And rst!ProdId = 4100 Then 'rst!SmLtDoor <> "Small Light Door" And rst!OrdId = Me.OrdId Then 'Or rst!Core <> "LBR" Then
strDocument = "Door Listing Flush"
DoCmd.OpenReport strDocument, acViewPreview, , "([ordid]=" & rst!OrdId & ") And ( Not [CORE]= """ & "LBR" & """) And (Not[smltdoor]is not null)"
End If
End If
End If
End If
End If
End If
rst.MoveNext
Loop
End If
rst.Close
Set dbs = Nothing
End Sub
Originally Posted by
ssanfu
So there is something happening with this one report or the VBA code.
Have you tried re-creating the report?
I believe the issue is with this one report. I haven't tried re-creating it. Do you mean from scratch??