R
Ross Culver
I've been working on an Access 2002 project and suddenly I've run into the error below when trying to set control values. Below the error I've pasted the code snipet that caused the error. I've never seen this error before so I'm not sure where to start.
Thanks
Error:
"The Microsoft Jet Database could not find the object ~sq~cbw_FrmMain~sq_SubPage"
Code Snipet:
Private Sub PkgNo_Enter()
If Me.PkgNo.Value = "" Or IsNull(Me.PkgNo.Value) = True And IsNull(Me.fshptoaddr.Value) = False Then
Dim rst As ADODB.Recordset, X As Integer, xPkgID As String, xSPkgID As String
Set rst = New ADODB.Recordset
With rst
Set .ActiveConnection = CurrentProject.Connection
.Source = "select max(cast(PkgNo as int)) as LastPkg from ShipData where fshipno = '" & Me.txtShipNo.Value & "'"
.LockType = adLockOptimistic
.CursorType = adOpenForwardOnly
.CursorLocation = adUseServer
.Open
End With
If IsNull(rst!lastpkg) = True Then
Me.PkgNo.Value = 1
xSPkgID = "VLPW" & Me.txtShipNo.Value & "M0001"
MsgBox xSPkgID
Me.txtSupplierPkgID.Value = xSPkgID
Else
X = rst!lastpkg + 1
Me.PkgNo.Value = X
If X < 10 Then
xPkgID = "000" & Trim(Str(X))
End If
If X > 9 And X < 100 Then
xPkgID = "00" & Trim(Str(X))
End If
If X > 99 And X < 1000 Then
xPkgID = "0" & Trim(Str(X))
End If
If X > 999 Then
xPkgID = Trim(Str(X))
End If
xSPkgID = "VLPW" & Me.txtShipNo.Value & "M" & xPkgID
Me.txtSupplierPkgID.Value = xSPkgID
End If
rst.Close
End If
End Sub
The line in bold underlined italics above is the highlighted error.
Thanks again.
Ross
Thanks
Error:
"The Microsoft Jet Database could not find the object ~sq~cbw_FrmMain~sq_SubPage"
Code Snipet:
Private Sub PkgNo_Enter()
If Me.PkgNo.Value = "" Or IsNull(Me.PkgNo.Value) = True And IsNull(Me.fshptoaddr.Value) = False Then
Dim rst As ADODB.Recordset, X As Integer, xPkgID As String, xSPkgID As String
Set rst = New ADODB.Recordset
With rst
Set .ActiveConnection = CurrentProject.Connection
.Source = "select max(cast(PkgNo as int)) as LastPkg from ShipData where fshipno = '" & Me.txtShipNo.Value & "'"
.LockType = adLockOptimistic
.CursorType = adOpenForwardOnly
.CursorLocation = adUseServer
.Open
End With
If IsNull(rst!lastpkg) = True Then
Me.PkgNo.Value = 1
xSPkgID = "VLPW" & Me.txtShipNo.Value & "M0001"
MsgBox xSPkgID
Me.txtSupplierPkgID.Value = xSPkgID
Else
X = rst!lastpkg + 1
Me.PkgNo.Value = X
If X < 10 Then
xPkgID = "000" & Trim(Str(X))
End If
If X > 9 And X < 100 Then
xPkgID = "00" & Trim(Str(X))
End If
If X > 99 And X < 1000 Then
xPkgID = "0" & Trim(Str(X))
End If
If X > 999 Then
xPkgID = Trim(Str(X))
End If
xSPkgID = "VLPW" & Me.txtShipNo.Value & "M" & xPkgID
Me.txtSupplierPkgID.Value = xSPkgID
End If
rst.Close
End If
End Sub
The line in bold underlined italics above is the highlighted error.
Thanks again.
Ross