J
Jose Garcia
Hi,
I want to construct a SQL sentence using VBA. Basically, the data that
compund the INSERTsentence belong to subform fields.
The data types of the fields are the following:
- Fecha --> (Date type)
- Designacion --> (String type)
- Numero --> (String type)
- Hoja -->(String type)
- Revision -->(Number type)
- Fecha_ult_revision-->(Date type)
I have tried to create the following expression, and code:
strSQL = "INSERT INTO Control (Fecha, Designacion, Descripcion, Numero,
Hoja, Revision, Fecha_ult_revision) VALUES (#" &
Format(Me!vigente.Form.Controls("Fecha"), "dd/mm/yyyy") & "#,'" &
Me!vigente.Form.Controls("Designacion") & "','" &
Me!vigente.Form.Controls("Descripcion") & "','" &
Me!vigente.Form.Controls("Numero") & "','" & Me!vigente.Form.Controls("Hoja")
& "'," & Me!vigente.Form.Controls("Revision") & ",#" &
Format(Me!vigente.Form.Controls("Fecha_ult_revision"), "dd/mm/yyyy") & "#)"
CurrentDb.Execute strSQL, dbFailOnError
But for my surprise, gives the following error: "It has produced '2465' in
runtime: Microsoft Office Access cannot find the 'vigente' field which is
referenced in a expresion".
I am shocked because Access doesn´t detect de subform name, but truthly has
this name.
I would very grateful if anybody could help me to solve it.
Regards
Jose
I want to construct a SQL sentence using VBA. Basically, the data that
compund the INSERTsentence belong to subform fields.
The data types of the fields are the following:
- Fecha --> (Date type)
- Designacion --> (String type)
- Numero --> (String type)
- Hoja -->(String type)
- Revision -->(Number type)
- Fecha_ult_revision-->(Date type)
I have tried to create the following expression, and code:
strSQL = "INSERT INTO Control (Fecha, Designacion, Descripcion, Numero,
Hoja, Revision, Fecha_ult_revision) VALUES (#" &
Format(Me!vigente.Form.Controls("Fecha"), "dd/mm/yyyy") & "#,'" &
Me!vigente.Form.Controls("Designacion") & "','" &
Me!vigente.Form.Controls("Descripcion") & "','" &
Me!vigente.Form.Controls("Numero") & "','" & Me!vigente.Form.Controls("Hoja")
& "'," & Me!vigente.Form.Controls("Revision") & ",#" &
Format(Me!vigente.Form.Controls("Fecha_ult_revision"), "dd/mm/yyyy") & "#)"
CurrentDb.Execute strSQL, dbFailOnError
But for my surprise, gives the following error: "It has produced '2465' in
runtime: Microsoft Office Access cannot find the 'vigente' field which is
referenced in a expresion".
I am shocked because Access doesn´t detect de subform name, but truthly has
this name.
I would very grateful if anybody could help me to solve it.
Regards
Jose