vb6错误 - 预期程序不可变

时间:2014-01-15 10:22:31

标签: vb6

当我按下我的搜索按钮

时,我得到标题中提到的上述错误

这是代码

我尝试设置断点并运行代码但是只要按下我的搜索按钮就会出现错误消息"预期程序不可变"弹出

我对vb6编程很新..有人可以帮忙吗?

   Private Sub cmdsearch_Click()

    If txtvehiclenumber = "" Then
       MsgBox " Please enter a vehicle number"
    Else

rsFiveGallonDelivery " select * from FiveGallonDelivery where Cstr(VehicleNumber) =  '" & txtvehiclenumber & "'", conn, adOpenDynamic, adLockReadOnly

If Not rsFiveGallonDelivery.BOF And Not rsFiveGallonDelivery.EOF Then
rsFiveGallonDelivery.MoveFirst
     txtdate = rsFiveGallonDelivery.Fields("Date")
     txtdeliverytimeoutrs = FiveGallonDelivery("DeliveryTimeOut")
     txtdeliverytimeinrs = FiveGallonDelivery("DeliveryTimeIn")
     txtfromfactory = rsFiveGallonDelivery.Fields("FromFactory")
     txtdeliverynotecount = rsFiveGallonDelivery.Fields("DeliveryNoteCount")
     txtfromoperations = rsFiveGallonDelivery.Fields("FromOperations")
     txtnormaldeliveries = rsFiveGallonDelivery.Fields("NormalDeliveries")
     txtnewdeliveries = rsFiveGallonDelivery.Fields("NewDeliveries")
     txtbottleincreases = rsFiveGallonDelivery.Fields("BottleIncreases")
     txtpromotions = rsFiveGallonDelivery.Fields("Promotions")
     txtreturnstooperations = rsFiveGallonDelivery.Fields("ReturnsToOperations")
     txtreturnstofactory = rsFiveGallonDelivery.Fields("ReturnsToFactory")
     txtfactorycount = rsFiveGallonDelivery.Fields("FactoryCount")

   Else
     MsgBox " No Such record "
  End If
  rsFiveGallonDelivery.Close

  End If
 End Sub

2 个答案:

答案 0 :(得分:0)

什么是rsFiveGallonDelivery?

您的代码现在将其视为一个过程(这就是错误消息)..

如果是字符串,则在变量和数据之间放置一个“=”

如果它是一个记录集(我猜它是)然后调用正确的函数来运行它之后的SQL查询

答案 1 :(得分:0)

也许你想打开一个记录集?

rsFiveGallonDelivery.Open " select *...