Error 2455 "Invalid Reference to the property Form"

F

Fulvio

I've been developing a DB in 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 with 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top