请老师给看看附件中的例子,提示:名称与存在的模块工程或对象冲突
修改了引用还是不行,不知什么原因?
同时这个例子请帮助修改一下代码使用ADO,来设计,感谢
Dim rs As ADODB.记录集
rs = New ADODB。Recordset
代码如下
Private Sub GetPONo_Click()
Dim Criteria As String, mydb As Database, myset As Recordset
Dim Value As Long, Counterstr As String
If IsNull(Me.PO_No) Or Me.PO_No <= " " Then
Criteria = "ID = 1"
Set mydb = DBEngine.Workspaces(0).Databases(0)
Set myset = mydb.OpenRecordset("POCounter_Remote", dbOpenDynaset)
myset.FindFirst Criteria
If Not myset.NoMatch Then
Me.PO_No = myset![Last_Counter]
Value = Val(myset![Last_Counter]) + 1
Counterstr = Right$(Trim$("00000000" + Trim$(Str(Value))), 8)
myset.Edit
myset![Last_Counter] = Counterstr
myset.Update
Me.PO_Date = Date
Else
MsgBox "Your PO Counter Table was empty, please contact IMM"
End If
myset.Close
Else
MsgBox "Sorry You must clear PO No before Continue"
Exit Sub
End If
End Sub
作者: roych 时间: 2023-4-1 15:09
myset As Recordset
改为:myset As DAO.Recordset再试试。
有ADO和DAO时,recorset之类,应该注明是ADO还是DAO,如果不注明,请设置好引用的有限顺序。如果ADO优先于DAO,这一行显然就有问题了:
Set myset = mydb.OpenRecordset("POCounter_Remote", dbOpenDynaset) 作者: yanwei82123300 时间: 2023-4-1 15:18
roych老师我按照您提示的方法改了还是不行,您给看看改一下,这个代码还是2002年的一个老例子,谢谢了 作者: yanwei82123300 时间: 2023-4-1 15:31
roych 发表于 2023-4-1 15:09
改为:myset As DAO.Recordset再试试。
有ADO和DAO时,recorset之类,应该注明是ADO还是DAO,如果不注明 ...