David McAfee
davidmcafee at gmail.com
Tue Nov 1 10:56:19 CDT 2011
I tried all of that, I even put debug.print statements in all of the
control events and in various subs that were being called.
I found that the condition would occur when the path was taken along the
first half of the IF statement.
I was able to replicate this problem on another computer using A2003.
I changed the code to open a recordset, rather than selecting a row in the
listbox and
reading values from hidden columns and it now works. Looks like a bug in
2003 that
was fixed in 2007.
This code works:
DoCmd.SetWarnings False
Me.lstModelSumm.RowSource = "EXEC dbo.stpSelectTempMach 0"
Me.lstPoResults.RowSource = "EXEC dbo.stpPurchasedMachinesByPO '" &
Me.txtTranNo & "'"
DoCmd.SetWarnings True
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
'Call the stored procedure, passing it the parameter, returning recordset rs
CurrentProject.Connection.stpPurchasedMachinesByPO IIf(Nz(Me.txtTranNo, "")
= "", 0, Me.txtTranNo), rs
'Fill in the fields from the returned recordset
If Not rs.BOF And Not rs.EOF Then
'code below is the same as sub: PopulateFields
Me.txtVendorCode = RTrim(Nz(rs![vendor_code], ""))
Me.txtVendorName = Nz(rs![vendor_name], "")
Me.txtTranDate = rs![po_date]
Me.txtPoStatus = Nz(rs![po_status], "")
Me.txtQty = Nz(rs![Qty], 0)
Me.txtCostBasis = Nz(rs![CostBasis], 0)
Me.txtModel = RTrim(Nz(rs![ItemNo], ""))
Me.txtModelID = Nz(rs![ModelID], "")
Me.cboLocationKey = CInt(Nz(rs![LocKeyID], "0"))
Call cboLocationKey_Change
Me.lstModelSumm.RowSource = "EXEC dbo.stpSelectTempMach 1"
Me.cmdEnterSN.Enabled = CanAddAnotherMachine()
Else
'No records were returned for given tran no
MsgBox "The PO number you entered did not return any records",
vbOKOnly, "Invalid PO"
Call ClearEntryFields
End If
rs.Close
Set rs = Nothing
On Mon, Oct 31, 2011 at 4:54 PM, Charlotte Foust
<charlotte.foust at gmail.com>wrote:
> Is this the only user or just the only one having problems? Is there a
> copy of the ADP on her box or is she accessing it from a network site? If
> the app is on her machine, have you done a decompile and recompile on the
> app? Once in a while breakpoints will get stuck and only recompiling will
> get rid of them. If you comment out all the code in that routine but leave
> the shell, does the application run without an error? Is the next control
> in the tab order one of the two you're resetting the rowsource on?
>
> Charlotte Foust
>