1
Visual Basic 6 / Re:Pasar codigo de mi programa en visual basic 6.0 a word 2007.
« en: Febrero 05, 2015, 04:18:28 pm »
Enter ¡Eres un grande!, funciona perfectamente. Muchas gracias.
Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.
''''DECLARACION EN UN MODULO'''''
Global Base As New ADODB.Connection
Global RsRegistros As New ADODB.Recordset
'''''''CONEXION EN OTRO MODULO''''''
Sub main()
With Base
.CursorLocation = adUseClient
.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Base.mdb;Persist Security Info=False"
MDIForm1.Show
End With
End Sub
Sub REGISTROS()
With RsRegistros
If .State = 1 Then .Close
.Open "select * from TablaRegistros", Base, adOpenStatic, adLockOptimistic
End With
End Sub
. Un saludo.
''''''''CODIGO FORM CREAR''''''
Private Sub ccmdReestablecer_Click()
LIMPIAR
End Sub
Private Sub cmdCerrar_Click()
Unload Me
End Sub
Private Sub cmdCrear_Click()
If txtNombre.Text = "" Then MsgBox "El campo GRUPO no puede estar vacio", vbInformation, "Aviso": txtNombre.SetFocus: Exit Sub
If txtInt1.Text = "" Then MsgBox "El campo Integrante 1 no puede estar vacio", vbInformation, "Aviso": txtInt1.SetFocus: Exit Sub
If txtInt2.Text = "" Then MsgBox "El campo Integrante 2 no puede estar vacio", vbInformation, "Aviso": txtInt2.SetFocus: Exit Sub
If txtInt3.Text = "" Then MsgBox "El campo Integrante 3 no puede estar vacio.En caso de que solo haya dos miembros en el grupo ponga un punto.", vbInformation, "Aviso": txtInt3.SetFocus: Exit Sub
With RsRegistros
.Requery
.AddNew
!grupo = txtNombre.Text
!fecha = DTPicker1.Value
!integrante1 = txtInt1.Text
!integrante2 = txtInt2.Text
!integrante3 = txtInt3.Text
.Update
.Requery
LIMPIAR
End With
FormatoGrillaRegistros
MsgBox " GRUPO CREADO", vbInformation, ""
Unload Me
End Sub
Private Sub Form_Load()
Skin1.LoadSkin App.Path & "\skin.skn" ''''' CARGAMOS EL SKIN
Skin1.ApplySkin RegistrosForm.hWnd '''''APLICAMOS EL SKIN A NUESTRO FORMULARIO
REGISTROS
DATOS
Set GrillaRegistros.DataSource = RsRegistros
FormatoGrillaRegistros
BLOQUEAR
End Sub
Sub LIMPIAR()
txtNombre.Text = ""
DTPicker1.Value = Date
txtInt1.Text = ""
txtInt2.Text = ""
txtInt3.Text = ""
txtNombre.SetFocus
End Sub
Sub FormatoGrillaRegistros()
With RsRegistros
GrillaRegistros.Columns(0).Width = 0
GrillaRegistros.Columns(1).Width = 2000
GrillaRegistros.Columns(2).Width = 1000
GrillaRegistros.Columns(3).Width = 3500
GrillaRegistros.Columns(4).Width = 3500
GrillaRegistros.Columns(5).Width = 3500
End With
End Sub
Sub BLOQUEAR()
GrillaRegistros.AllowUpdate = False
End Sub
''''''''CODIGO FORM MODIFICAR''''''
Private Sub ccmdReestablecer_Click()
LIMPIAR
End Sub
Private Sub cmdModificar_Click()
If lblIdregistros.Caption = "" Then MsgBox "Selecciona un Grupo a modificar", vbInformation, "Aviso": Exit Sub
If txtNombre.Text = "" Then MsgBox "El campo nombre no puede estar vacio", vbInformation, "Aviso": txtNombre.SetFocus: Exit Sub
If txtInt1.Text = "" Then MsgBox "El campo Integrante 1 no puede estar vacio", vbInformation, "Aviso": txtInt1.SetFocus: Exit Sub
If txtInt2.Text = "" Then MsgBox "El campo Integrante 2 no puede estar vacio", vbInformation, "Aviso": txtInt2.SetFocus: Exit Sub
If txtInt3.Text = "" Then MsgBox "El campo Integrante 3 no puede estar vacio.En caso de que solo haya dos miembros en el grupo ponga un punto.", vbInformation, "Aviso": txtInt3.SetFocus: Exit Sub
With RsRegistros
.Requery
.Find "IdRegistros='" & Val(lblIdregistros.Caption) & "'"
!grupo = txtNombre.Text
!fecha = DTPicker1.Value
!integrante1 = txtInt1.Text
!integrante2 = txtInt2.Text
!integrante3 = txtInt3.Text
.UpdateBatch
.Requery
LIMPIAR
BLOQUEAR
End With
FormatoGrillaRegistros
MsgBox " GRUPO MODIFICADO", vbInformation, ""
Unload Me
End Sub
Private Sub Form_Load()
Skin1.LoadSkin App.Path & "\skin.skn" ''''' CARGAMOS EL SKIN
Skin1.ApplySkin ModificarRegistrosForm.hWnd '''''APLICAMOS EL SKIN A NUESTRO FORMULARIO
REGISTROS
DATOS
Set GrillaRegistros.DataSource = RsRegistros
FormatoGrillaRegistros
BLOQUEAR
GrillaRegistros.AllowUpdate = False
End Sub
Sub FormatoGrillaRegistros()
With RsRegistros
GrillaRegistros.Columns(0).Width = 0
GrillaRegistros.Columns(1).Width = 2000
GrillaRegistros.Columns(2).Width = 1000
GrillaRegistros.Columns(3).Width = 3500
GrillaRegistros.Columns(4).Width = 3500
GrillaRegistros.Columns(5).Width = 3500
End With
End Sub
Private Sub GrillaRegistros_Click()
With RsRegistros
If .BOF Or .EOF Then Exit Sub
.Find "IdRegistros='" & Val(GrillaRegistros.Columns(0).Text) & "'"
lblIdregistros.Caption = !IdRegistros
txtNombre.Text = !grupo
DTPicker1.Value = !fecha
txtInt1.Text = !integrante1
txtInt2.Text = !integrante2
txtInt3.Text = !integrante3
DESBLOQUEAR
'lblCodigo.Caption = !IdRegistros
End With
End Sub
Sub LIMPIAR()
txtNombre.Text = ""
DTPicker1.Value = Date
txtInt1.Text = ""
txtInt2.Text = ""
txtInt3.Text = ""
txtNombre.SetFocus
End Sub
Sub BLOQUEAR()
txtNombre.Locked = True
txtInt1.Locked = True
txtInt2.Locked = True
txtInt3.Locked = True
DTPicker1.Enabled = False
End Sub
Sub DESBLOQUEAR()
txtNombre.Locked = False
txtInt1.Locked = False
txtInt2.Locked = False
txtInt3.Locked = False
DTPicker1.Enabled = True
End Sub
Una consulta, el usuario 1-PEPITO debe ingresar sus 10 valores X, sus 10 valores Y(lo llamamos conjuntoA) en la base de datos pero esta info sera la única q deberá ingresar, guardar y estar relacionada con pepito o en algún caso pepito deberá crear y guardar un conjuntoA, conjuntoB y hasta conjuntoC
es justo lo que me hacia falta muchisimas gracias de nuevo¡¡¡¡¡ Un saludo y feliz 2015¡¡¡