soy nuevo en el foro, aunque lo he usado mucho para mi proyecto.
he migrado mi base de datos a mysql, he modificado las macros para insertar nuevos datos en una tabla, en este caso la tabla clientes.
el caso es que aunque me inserta los datos correctamente me salta un error que dice
"NO HAY ACCESO AL OBJETO. USO DE OBJETO NO VALIDO"
llevo tiempo intentando resolverlo pero no lo consigo
Alguien sabe como?
el codigo es el siguiente
Código: Seleccionar todo
sub crea_registro (Event as object)
Dim oForm As Object
dim oCtrl as object
dim oStat as object
dim oRes as object
dim iban as string
dim banc as string
dim of as string
dim dc as string
dim cc as string
dim nom as string
dim ap_pat as string
dim ap_mat as string
dim cif_nif as string
dim dir as string
dim num as string
dim cp as string
dim pobla as string
dim tel as string
dim mob1 as string
dim mob2 as string
dim e_mail as string
dim num_cli as string
dim dto as variant
dim sSql as string
dim cont as integer
oForm = Event.Source.Model.Parent
cc = oForm.GetByName("textCC").Text
nom = oForm.GetByName("txtNOMBRE").Text
do
nom= mid(nom,1, len(nom)-1)
loop while right(nom,1)=" "
ap_pat =oForm.GetByName("txtAP_PAT").Text
do
ap_pat= mid(ap_pat,1, len(ap_pat)-1)
loop while right(ap_pat,1)=" "
ap_mat =oForm.GetByName("txtAP_MAT").Text
do
ap_mat= mid(ap_mat,1, len(ap_mat)-1)
loop while right(ap_mat,1)=" "
cif_nif = oForm.GetByName("txtNIF_CIF").Text
dir = oForm.GetByName("txtDIRECCION").Text
do
dir= mid(dir,1, len(dir)-1)
loop while right(dir,1)=" "
num =oForm.GetByName("txtNUM").Text
cp =oForm.GetByName("txtCP").Text
pobla = oForm.GetByName("txtPOBLACION").Text
do
pobla= mid (pobla,1, len(pobla)-1)
loop while right(pobla,1)=" "
tel = oForm.GetByName("txtTELEFONO").Text
mob1 =oForm.GetByName("txtMOBIL1").Text
mob2 = oForm.GetByName("txtMOBIL2").Text
e_mail = oForm.GetByName("txtE-MAIL").Text
cont=0
do
e_mail= mid (e_mail,1, len(e_mail)-cont)
cont=cont +1
loop while right(e_mail,1)=" "
'num_cli = oForm.GetByName("txtNUM_CLIENT").Text
dto = oForm.GetByName("fmtDTO").Text
sSql ="INSERT INTO piscinas.CLIENTES (NOMBRE, AP_PAT, AP_MAT, NIF_CIF, DIRECCION, NUM, CP, POBLACION, "
sSql =sSql + "TELEFONO, MOBIL1, MOBIL2, E_MAIL, DTO, CC) VALUES ('" +nom +"','"+ ap_pat +"','"+ ap_mat
sSql= sSql + "','" +cif_nif+ "','" +dir+ "','" +num+ "','" +cp+ "','" +pobla+ "','"
sSql= sSql +tel+ "','" +mob1+ "','" +mob2+"','" +e_mail+"','" +dto+ "','" +cc+"')"
'sSql ="INSERT INTO CLIENT (NOMBRE) VALUES (""PEDRO"")"
'sSql = sSql + nom +"','"+ ap_pat +"','"+ap_mat +"')"
msgbox sSql
oStat =ThisDatabaseDocument.CurrentController.ActiveConnection.CreateStatement
oRes=oStat.executeUpdate(sSql)
ThisComponent.CurrentController.Frame.Close(true)
end sub