Runtime error 2448

Wyoming
StarLounger
Posts: 76
Joined: 04 Jan 2013, 12:07

Runtime error 2448

Post by Wyoming »

Hello,

this is driving me crazy...
I have a very simple piece of code in a form under the onload event:

Code: Select all

If intOrigenAccion = 1 Then
    Me.COD_CLIENTE.Value = strCodCliente
    Me.txtNombreOportunidad.Enabled = False
ElseIf intOrigenAccion = 2 Then
    MsgBox "id oportunidad = " & intIdOportunidad
    Me.txtIdOportunidad = intIdOportunidad
    Me.txtNombreCliente.Enabled = False
End If
The first condition of it (when intOrigenAccion = 1) works fine
But if If intOrigenAccion = 2, then I get the error 2448 - You can't assign a value to this object (sometimes I get the error -2147352567, which is basically the same thing, I guess) when doing this Me.txtIdOportunidad = intIdOportunidad.

I have checked through a MsgBox that the value of the variable is what is expected (an integer)
The sourcefield type of "txtIdOportunidad" is also integer
The allow edit property of the form is set to yes
I have even deleted all the DB relationships but I'm still getting the error.

What else can I check to see what's wrong?

Thanks

Wyoming
StarLounger
Posts: 76
Joined: 04 Jan 2013, 12:07

Re: Runtime error 2448

Post by Wyoming »

Thank you Rudi,

Unfortunately it doesn't work, that was one of my first attempts. The only difference between adding "value" or not is that error you get is either "2448" or "-2147352567"
I have also tried referencing the table field name instead of the form field name, but It doesn't make any difference.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Runtime error 2448

Post by Rudi »

I see you saw my reply before I deleted it. :sorry:
After posting the reply I found a thread that confirmed it would not work so I deleted the reply....but you obviously came back while I was doing it.

Anyways...it was just a guess.
I trust Hans will have a reply for you. He is our resident Access guru!
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Runtime error 2448

Post by HansV »

I assume that you have checked that the Locked property of txtIdOportunidad is set to No and the Enabled property to Yes.

Is the record source of the form a table or a query? If it is a query, can you edit the source field of txtIdOportunidad in the query?
Best wishes,
Hans

Wyoming
StarLounger
Posts: 76
Joined: 04 Jan 2013, 12:07

Re: Runtime error 2448

Post by Wyoming »

Hello Hans,

yes, I have checked both Locked and Enabled properties and they're ok.
The form source is a query and it doesn't allow me to edit COD_CLIENTE neither ID_OPORTUNIDAD which is the source for txtIdOportunidad.
Now I have realized that even though the form wasn't raising an error message, the 1st part of the "if" wasn't actually saving a record in the table.

So it seems that the way the query is built should be changed, or should I try to use a table as a source for the form in order to avoid this issues?

The query the form is based in is (Where ID_OPORTUNIDAD is the source of txtIdOportunidad)

Code: Select all

SELECT ACCIONES.ID_ACCION, ACCIONES.FECHA_ACCION, CLIENTES.COD_CLIENTE, CLIENTES.NOM_CLIENTE, ACCIONES.iD_TIPO_ACCION, ACCIONES.OBSERVACIONES, ACCIONES.HORA_PROGRAMADA, OPORTUNIDADES.ID_OPORTUNIDAD, OPORTUNIDADES.NOMBRE_OPORTUNIDAD, ACCIONES.REALIZADO, ACCIONES.FECHA_PROGRAMADA, ACCIONES.ID_USUARIO
FROM OPORTUNIDADES RIGHT JOIN (CLIENTES RIGHT JOIN ACCIONES ON CLIENTES.COD_CLIENTE = ACCIONES.COD_CLIENTE) ON OPORTUNIDADES.ID_OPORTUNIDAD = ACCIONES.ID_OPORTUNIDAD;

Wyoming
StarLounger
Posts: 76
Joined: 04 Jan 2013, 12:07

Re: Runtime error 2448

Post by Wyoming »

Ok, so it was that, the way the query was built.
I have changed it now into this

Code: Select all

SELECT ACCIONES.ID_ACCION, ACCIONES.FECHA_ACCION, ACCIONES.COD_CLIENTE, CLIENTES.NOM_CLIENTE, ACCIONES.iD_TIPO_ACCION, ACCIONES.OBSERVACIONES, ACCIONES.HORA_PROGRAMADA, ACCIONES.ID_OPORTUNIDAD, OPORTUNIDADES.NOMBRE_OPORTUNIDAD, ACCIONES.REALIZADO, ACCIONES.FECHA_PROGRAMADA, ACCIONES.ID_USUARIO
FROM OPORTUNIDADES RIGHT JOIN (CLIENTES RIGHT JOIN ACCIONES ON CLIENTES.COD_CLIENTE = ACCIONES.COD_CLIENTE) ON OPORTUNIDADES.ID_OPORTUNIDAD = ACCIONES.ID_OPORTUNIDAD;
and it works.
I probably wouldn't have noticed it without your help.

Thanks a lot!

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Runtime error 2448

Post by HansV »

Yes, that's what I was going to propose. :thumbup:
Best wishes,
Hans