Office中国论坛/Access中国论坛

标题: “参数不足,期待是1” [打印本页]

作者: petrelai    时间: 2004-4-8 23:36
标题: “参数不足,期待是1”
Dim id, date2 As String

Me.单据类别 = 2
Me.单据日期.Value = Date
date2 = "S" & Right(Format([单据日期], "YYMMDD"), 5)
   id = DMax("[单据编号]", "[销售出库]", "[单据编号] Like '" & date2 & "??'")
     If IsNull(id) Then
      Me.单据编号 = date2 & "01"
      Me.单据编号.SetFocus
   Else
      Me.单据编号 = date2 & Format(CStr(CInt(Right(id, 2)) + 1), "00")
      Me.单据编号.SetFocus
   End If
   
Dim bian, ku, wan, wei, qi, qian, zi, shu, shao
Dim e As Currency
Dim ri As Date
Dim db As DAO.Database
Dim xiaoshuo, kuchunbiao, xiaori As DAO.Recordset
Dim strXs, strXs1, strXs2 As String

Set db = CurrentDb()
[B]strXs = "select 销售出库明细.商品编号,销售出库明细.商品类别,销售出库明细.品名规格,销售出库明细.进货价,销售出库明细.商品售价,销售出库明细.数量 from 销售出库明细 where 销售出库明细.销售出库ID = '" & Forms!报价窗口!销售出库ID & "'"[/B]运行到这里时就出现主题里所说的问题了。Set xiaoshuo = db.OpenRecordset(strXs, dbOpenDynaset)
Do While Not Rs.EOF
  bian = xiaoshuo("商品编号")
  shu = xiaoshuo("数量")
  shao = xiaoshuo("商品售价")
  
  strXs1 = "select 库存表.商品编号,库存表.商品进价 where 库存表.商品编号 = '" & bian & "'" & "and  库存表.完结 = " & False & ""
  Set kuchunbiao = db.OpenRecordset(strXs1, dbOpenDynaset)
    xiaoshuo("进货价") = kuchunbiao("商品进价")
    kuchunbiao("库存量") = kuchunbiao("库存量") - shu
    If kuchunbiao("库存量") = 0 Then
      kuchunbiao("完结") = True
    End If
   kuchunbiao.Update
  
  Set xiaori = db.OpenRecordset("销售日志", dbOpenDynaset)
    xiaori.AddNew
    xiaori("类型") = Me.单据类别.Column(1)
    xiaori("日期") = Forms![报价窗口]![单据日期]
    xiaori("商品编号") = bian
    xiaori("数量") = shu
    xiaori("商品进价") = xiaoshuo("进货价")
    xiaori("商品售价") = shao
    xiaori.Update
   
  xiaoshuo.MoveNext
  Loop
  
   MsgBox "该报价单已转为销售单,请记住单据编号!", 64, "转换成功……"


End Sub

作者: zhengjialon    时间: 2004-4-9 00:29
看一下你的“销售出库ID ”是不是数值型的,如果是那么单引号是不用的。
作者: petrelai    时间: 2004-4-9 00:53
谢谢,已解决!




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