lotharious
MIS
Code:
Dim cn As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim s As String
Set cn = CurrentProject.Connection
s = "SELECT InvMatInProcess.Cut FROM InvMatInProcess "
s = s & "WHERE (((InvMatInProcess.Item)='" & Me![Material] & "') AND ((InvMatInProcess.PO)="
s = s & Me![PO] & "))"
Debug.Print s
rs.Open s, cn
If IsNull(rs!Cut) Or rs.EOF Then
Me!CutAmt = "N/A"
Else
Me!CutAmt = rs!Cut
End If
rs.Close
Debug output
Code:
SELECT InvMatInProcess.Cut FROM InvMatInProcess WHERE (((InvMatInProcess.Item)='I-MW1/4') AND ((InvMatInProcess.PO)=576))
The Query works correctly and gives me the accurate number for InvMatInProcess.Cut if I run the query in design mode.
However the vba code is returning EOF for the recordset.
Im not sure where to look for the problem. Other code that is similar works fine for me. Any ideas?