Mantenimiento de Clientes
Publicado por Cielo (9 intervenciones) el 28/09/2007 23:12:30
Buenas Tardes chicos, gracias por su ayuda, yo soy nueva en esto, actualmente me encuentro desarrollando una aplicacion de vb con sql, ahora estoy en el form de mantenimiento de clientes, yo en el mantenimiento he hecho q el usuario busque por código al cliente, luego una vez q seleccionamos al cliente al hacer clic aparecerán los datos de éste y luego aquí ya se podría modificar sus datos, mi pregunta es...puedo hacer ese mantenimiento buscando el nombre del cliente..?...y al hacerle clic a éste...una vez q muestre todos los datos de este cliente (incluído nuevamente su nombre..podría modificarlo..?...ya que el usuario no sabría qué código tiene cada cliente....porfis denme ideas y discúlpenme si comento o cometo una disparatada...muchas gracias por su ayuda, éste es mi código actual, queriendo hacer el mantenimiento por nomcliente
If cmbcli = "" Then Exit Sub
CargarRegistros rscl, "Cliente"
With rscl
.MoveFirst
.Find "[codcliente]='" + cmbcli + "'"
txtnomcli = IIf(IsNull(!nomcliente), "", !nomcliente)
txtruc = IIf(IsNull(!ruccliente), "", !ruccliente)
txtdircli = IIf(IsNull(!direccion), "", !direccion)
txtdistrito = IIf(IsNull(!distrito), "", !distrito)
txtcodpostal = IIf(IsNull(!codpostal), "", !codpostal)
txtpais = IIf(IsNull(!pais), "", !pais)
Txttel = IIf(IsNull(!telefono1), "", !telefono1)
Txtfax = IIf(IsNull(!fax), "", !fax)
txtemail = IIf(IsNull(!email), "", !email)
Txtcont = IIf(IsNull(!nomcontacto1), "", !nomcontacto1)
txtcargo = IIf(IsNull(!cargocontacto1), "", !cargocontacto1)
txttelcont = IIf(IsNull(!telcontacto1), "", !telcontacto1)
txtpw = IIf(IsNull(!pagweb), "", !pagweb)
End With
rscl.Close
// Aquí me sale el error
Private Sub cmdact_Click()
On Error GoTo control
CargarRegistros rscl, "Cliente"
If MsgBox("¿Desea Actualizar los Datos?", vbYesNo + vbQuestion) = vbYes Then
If cmbcli <> "" Or txtnomcli <> "" Or txtdircli <> "" Or txtdistrito <> "" Or txtcodpostal <> "" Or txtpais <> "" Or Txttel <> "" Or Txtfax <> "" Or txtcargo <> "" Or txtemail <> "" Or Txtcont <> "" Or txttelcont <> "" Or txtpw <> "" Then
xgraba = "Update Cliente set nomcliente='" & txtnomcli & "', ruccliente = '" & txtruc & "', direccion='" & txtdircli & "', distrito ='" & txtdistrito & "',codpostal='" & txtcodpostal & "', pais='" & txtpais & "', telefono1='" & Txttel & "', fax='" & Txtfax & "', email='" & txtemail & "', nomcontacto1='" & Txtcont & "', cargocontacto1='" & txtcargo & "', telcontacto1='" & txttelcont & "', pagweb = '" & txtpw & "' where nomcliente=" & cmbcli.Text
cn.Execute (xgraba)
rscl.Requery
Else
MsgBox "Debe completar los Datos", vbCritical
txtnomcli.SetFocus
End If
cmdmodi.Enabled = True
cmdact.Enabled = False
txtnomcli.Enabled = False
txtruc.Enabled = False
txtdircli.Enabled = False
txtdistrito.Enabled = False
txtcodpostal.Enabled = False
txtpais.Enabled = False
Txttel.Enabled = False
Txtfax.Enabled = False
txtemail.Enabled = False
Txtcont.Enabled = False
txtcargo.Enabled = False
txttelcont.Enabled = False
txtpw.Enabled = False
End If
rscl.Close
Exit Sub
control:
MsgBox Str(Err.Number) + ": " + Err.Description, vbCritical, "Quimichem"
End Sub
If cmbcli = "" Then Exit Sub
CargarRegistros rscl, "Cliente"
With rscl
.MoveFirst
.Find "[codcliente]='" + cmbcli + "'"
txtnomcli = IIf(IsNull(!nomcliente), "", !nomcliente)
txtruc = IIf(IsNull(!ruccliente), "", !ruccliente)
txtdircli = IIf(IsNull(!direccion), "", !direccion)
txtdistrito = IIf(IsNull(!distrito), "", !distrito)
txtcodpostal = IIf(IsNull(!codpostal), "", !codpostal)
txtpais = IIf(IsNull(!pais), "", !pais)
Txttel = IIf(IsNull(!telefono1), "", !telefono1)
Txtfax = IIf(IsNull(!fax), "", !fax)
txtemail = IIf(IsNull(!email), "", !email)
Txtcont = IIf(IsNull(!nomcontacto1), "", !nomcontacto1)
txtcargo = IIf(IsNull(!cargocontacto1), "", !cargocontacto1)
txttelcont = IIf(IsNull(!telcontacto1), "", !telcontacto1)
txtpw = IIf(IsNull(!pagweb), "", !pagweb)
End With
rscl.Close
// Aquí me sale el error
Private Sub cmdact_Click()
On Error GoTo control
CargarRegistros rscl, "Cliente"
If MsgBox("¿Desea Actualizar los Datos?", vbYesNo + vbQuestion) = vbYes Then
If cmbcli <> "" Or txtnomcli <> "" Or txtdircli <> "" Or txtdistrito <> "" Or txtcodpostal <> "" Or txtpais <> "" Or Txttel <> "" Or Txtfax <> "" Or txtcargo <> "" Or txtemail <> "" Or Txtcont <> "" Or txttelcont <> "" Or txtpw <> "" Then
xgraba = "Update Cliente set nomcliente='" & txtnomcli & "', ruccliente = '" & txtruc & "', direccion='" & txtdircli & "', distrito ='" & txtdistrito & "',codpostal='" & txtcodpostal & "', pais='" & txtpais & "', telefono1='" & Txttel & "', fax='" & Txtfax & "', email='" & txtemail & "', nomcontacto1='" & Txtcont & "', cargocontacto1='" & txtcargo & "', telcontacto1='" & txttelcont & "', pagweb = '" & txtpw & "' where nomcliente=" & cmbcli.Text
cn.Execute (xgraba)
rscl.Requery
Else
MsgBox "Debe completar los Datos", vbCritical
txtnomcli.SetFocus
End If
cmdmodi.Enabled = True
cmdact.Enabled = False
txtnomcli.Enabled = False
txtruc.Enabled = False
txtdircli.Enabled = False
txtdistrito.Enabled = False
txtcodpostal.Enabled = False
txtpais.Enabled = False
Txttel.Enabled = False
Txtfax.Enabled = False
txtemail.Enabled = False
Txtcont.Enabled = False
txtcargo.Enabled = False
txttelcont.Enabled = False
txtpw.Enabled = False
End If
rscl.Close
Exit Sub
control:
MsgBox Str(Err.Number) + ": " + Err.Description, vbCritical, "Quimichem"
End Sub
Valora esta pregunta


0