Office中国论坛/Access中国论坛

标题: 求救,哪位大侠能帮我看看问题出在哪儿吗 [打印本页]

作者: regiliu    时间: 2010-1-26 15:55
标题: 求救,哪位大侠能帮我看看问题出在哪儿吗
Private Sub Incoming_Qty_AfterUpdate()


Dim conn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Set conn = CurrentProject.Connection
rst.CursorLocation = adUseClient
Dim co As String
Dim qty As Integer
rst.Open " select [A].[cust po] as co, [A].[QTY] as qty from [A] where ([A].[cust po]='" + Me.Cust_PO + "')", conn, adOpenStatic, adLockPessimistic
With rst
If Not rst.EOF Then
                   If IsNull(Me.Incoming_Qty) = False Then
                                                           If qty >= Me.Incoming_Qty Then
                                                                                       Me.Text18 = Me.Cust_PO
                                                                                       Me.Text20 = Me.Incoming_Qty
                                                                                       DoCmd.GoToRecord , , acNewRec
                                                                                       Me.Cust_PO = ""
                                                                                       Me.Incoming_Qty = ""
                                                           Else: MsgBox "数量超出"
                                                                 Me.Text22 = qty
                                                                 
                                                           End If
                                       
                   Else: MsgBox "请输入数量"
                   End If
End If
End With
rst.Close
End Sub

哪位大侠帮我看看,为啥qty一直显示为0?谢谢!
作者: tz-chf    时间: 2010-1-26 17:34
没赋值当然默认为0




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3