F
Fulvio
I've been developing a DB using Access 2003 (in access 2000 format).
Everything
works fine. Then I put it on a real Acces 2000 (with all patches and
updates, OS is still XP) and I get the error 2455
The code is within the open event of a form containing a subform (within the
control VociPreventivo)
Here is the code, if anyone can help me.
Thanks,
Fulvio
'Indicates which menu calls the form
If Len(Me.OpenArgs) > 0 Then
Chiamante = Me.OpenArgs
Else
Chiamante = 1
End If
Set CurDb = CurrentDb
ApriConnessione CurDb, CurConn 'sub to open a db connection
CurConn.BeginTrans
Select Case Chiamante
Case 1 '<------- THIS CASE IS NOT WORKING (creates a new set of
data)
'Gets a counter number
src = "SELECT Max(IdPreventivo)AS Massimo FROM Preventivo;"
IdPrev = TrovaMax(src, CurConn)
'Data Source for the form
src = "SELECT * FROM Preventivo WHERE IdPreventivo=" & IdPrev &
";"
Me.VociPreventivo.Visible = False
'Data Source for the subform
srcSub = "SELECT * FROM VociPreventivo WHERE IdProgetto=" &
IdPrev & " ORDER by IdVoce;"
Case 2 '<--------- THIS IS WORKING (the control comes from a search
form)
IdPrev =
Forms("preventivo_Cerca").Controls("CercaPreventivo").Value
'Data Source for the form
src = "SELECT * FROM Preventivo WHERE IdPreventivo=" & IdPrev &
";"
Me.VociPreventivo.Visible = True
Me.IdPreventivo.Locked = True
'Data Source for the subform
srcSub = "SELECT * FROM VociPreventivo WHERE IdProgetto=" &
IdPrev & " ORDER by IdVoce;"
End Select
'Links the main form to the datasource
With RsMaster
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.CursorLocation = adUseClient
End With
RsMaster.Open src, CurConn, , , adCmdTableDirect
Set Me.Recordset = RsMaster
'Links the subform to its datasource
With RsChild
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.CursorLocation = adUseClient
End With
RsChild.Open srcSub, CurConn
Set Me.VociPreventivo.Form.Recordset = RsChild '<---------------------
HERE I GET THE ERROR IN THE CASE 1. CASE 2 WORKS PERFECTLY
Everything
works fine. Then I put it on a real Acces 2000 (with all patches and
updates, OS is still XP) and I get the error 2455
The code is within the open event of a form containing a subform (within the
control VociPreventivo)
Here is the code, if anyone can help me.
Thanks,
Fulvio
'Indicates which menu calls the form
If Len(Me.OpenArgs) > 0 Then
Chiamante = Me.OpenArgs
Else
Chiamante = 1
End If
Set CurDb = CurrentDb
ApriConnessione CurDb, CurConn 'sub to open a db connection
CurConn.BeginTrans
Select Case Chiamante
Case 1 '<------- THIS CASE IS NOT WORKING (creates a new set of
data)
'Gets a counter number
src = "SELECT Max(IdPreventivo)AS Massimo FROM Preventivo;"
IdPrev = TrovaMax(src, CurConn)
'Data Source for the form
src = "SELECT * FROM Preventivo WHERE IdPreventivo=" & IdPrev &
";"
Me.VociPreventivo.Visible = False
'Data Source for the subform
srcSub = "SELECT * FROM VociPreventivo WHERE IdProgetto=" &
IdPrev & " ORDER by IdVoce;"
Case 2 '<--------- THIS IS WORKING (the control comes from a search
form)
IdPrev =
Forms("preventivo_Cerca").Controls("CercaPreventivo").Value
'Data Source for the form
src = "SELECT * FROM Preventivo WHERE IdPreventivo=" & IdPrev &
";"
Me.VociPreventivo.Visible = True
Me.IdPreventivo.Locked = True
'Data Source for the subform
srcSub = "SELECT * FROM VociPreventivo WHERE IdProgetto=" &
IdPrev & " ORDER by IdVoce;"
End Select
'Links the main form to the datasource
With RsMaster
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.CursorLocation = adUseClient
End With
RsMaster.Open src, CurConn, , , adCmdTableDirect
Set Me.Recordset = RsMaster
'Links the subform to its datasource
With RsChild
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.CursorLocation = adUseClient
End With
RsChild.Open srcSub, CurConn
Set Me.VociPreventivo.Form.Recordset = RsChild '<---------------------
HERE I GET THE ERROR IN THE CASE 1. CASE 2 WORKS PERFECTLY