Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/10/2008, 18:11
spiderman78
 
Fecha de Ingreso: abril-2008
Mensajes: 281
Antigüedad: 16 años, 1 mes
Puntos: 1
Respuesta: Guardar registros en dos tablas

ok ahorita estoy guardando mi informacion con el siguiente codigo y me funciona bien

Cita:
Private Sub agregaragenda1()
If Text8.Text = "" Then
Call VisualizarAgenda
Set RecSQL = New ADODB.Recordset
RecSQL.Open "INSERT INTO agenda (fechaa,fechab,fecha,idpaciente0,paciente0,s0,p0,a 0,pago0,idpaciente1,paciente1,s1,p1,a1,pago1,idpac iente2,paciente2,s2,p2,a2,pago2,idpaciente3,pacien te3,s3,p3,a3,pago3,idpaciente4,paciente4,s4,p4,a4, pago4,idpaciente5,paciente5,s5,p5,a5,pago5,idpacie nte6,paciente6,s6,p6,a6,pago6,idpaciente7,paciente 7,s7,p7,a7,pago7,idpaciente8,paciente8,s8,p8,a8,pa go8,idpaciente9,paciente9,s9,p9,a9,pago9,idpacient e10,paciente10,s10,p10,a10,pago10,idpaciente11,pac iente11,s11,p11,a11,pago11,idpaciente12,paciente12 ,s12,p12,a12,pago12,idpaciente13,paciente13,s13,p1 3,a13,pago13,idpaciente14,paciente14,s14,p14,a14,p ago14,idpaciente15,paciente15,s15,p15,a15,pago15,i dpaciente16,paciente16,s16,p16,a16,pago16,idpacien te17,paciente17,s17,p17,a17,pago17," & _
"idpaciente18,paciente18,s18,p18,a18,pago18,idpaci ente19,paciente19,s19,p19,a19,pago19,idpaciente20, paciente20,s20,p20,a20,pago20,idpaciente21,pacient e21,s21,p21,a21,pago21,idpaciente22,paciente22,s22 ,p22,a22,pago22,pago)" & _
"VALUES (" & Text0(1) & ",'" & Text0(1) & "','" & Text1(0) & "','" & Text2(400) & "','" & Combo3 & "','" & Text5(0) & "','" & Check2(200) & "','" & Text6(0) & "','" & Text2(500) & "','" & Text2(401) & "','" & Combo4 & "','" & Text5(1) & "','" & Check2(201) & "','" & Text6(1) & "','" & Text2(501) & "','" & Text2(402) & "','" & Combo5 & "','" & Text5(2) & "','" & Check2(202) & "','" & Text6(2) & "','" & Text2(502) & "','" & Text2(403) & "','" & Combo6 & "','" & Text5(3) & "','" & Check2(203) & "','" & Text6(3) & "','" & Text2(503) & "','" & Text2(404) & "','" & Combo7 & "','" & Text5(4) & "','" & Check2(204) & "','" & Text6(4) & "','" & Text2(504) & "','" & Text2(405) & "','" & Combo8 & "','" & Text5(5) & "','" & Check2(205) & "','" & Text6(5) & "','" & Text2(505) & "','" & Text2(406) & "','" & Combo9 & "','" & Text5(6) & "','" & Check2(206) & "','" & Text6(6) & "','" & Text2(506) & "','" & Text2(407) & "','" & Combo10 & "','" & Text5(7) & "','" & Check2(207) & "','" & Text6(7) & "', " & _
" '" & Text2(507) & "','" & Text2(408) & "','" & Combo11 & "','" & Text5(8) & "','" & Check2(208) & "','" & Text6(8) & "','" & Text2(508) & "','" & Text2(409) & "','" & Combo12 & "','" & Text5(9) & "','" & Check2(209) & "','" & Text6(9) & "','" & Text2(509) & "','" & Text2(410) & "','" & Combo13 & "','" & Text5(10) & "','" & Check2(210) & "','" & Text6(10) & "','" & Text2(510) & "','" & Text2(411) & "','" & Combo14 & "','" & Text5(11) & "','" & Check2(211) & "','" & Text6(11) & "','" & Text2(511) & "','" & Text2(412) & "','" & Combo15 & "','" & Text5(12) & "','" & Check2(212) & "','" & Text6(12) & "','" & Text2(512) & "','" & Text2(413) & "','" & Combo16 & "','" & Text5(13) & "','" & Check2(213) & "','" & Text6(13) & "','" & Text2(513) & "','" & Text2(414) & "','" & Combo17 & "','" & Text5(14) & "','" & Check2(214) & "','" & Text6(14) & "','" & Text2(514) & "','" & Text2(415) & "','" & Combo18 & "','" & Text5(15) & "','" & Check2(215) & "','" & Text6(15) & "','" & Text2(515) & "', " & _
" '" & Text2(416) & "','" & Combo19 & "','" & Text5(16) & "','" & Check2(216) & "','" & Text6(16) & "','" & Text2(516) & "','" & Text2(417) & "','" & Combo20 & "','" & Text5(17) & "','" & Check2(217) & "','" & Text6(17) & "','" & Text2(517) & "','" & Text2(418) & "','" & Combo21 & "','" & Text5(18) & "','" & Check2(218) & "','" & Text6(18) & "','" & Text2(518) & "','" & Text2(419) & "','" & Combo22 & "','" & Text5(19) & "','" & Check2(219) & "','" & Text6(19) & "','" & Text2(519) & "','" & Text2(420) & "','" & Combo23 & "','" & Text5(20) & "','" & Check2(220) & "','" & Text6(20) & "','" & Text2(520) & "','" & Text2(421) & "','" & Combo24 & "','" & Text5(21) & "','" & Check2(221) & "','" & Text6(21) & "','" & Text2(521) & "','" & Text2(422) & "','" & Combo25 & "','" & Text5(22) & "','" & Check2(222) & "','" & Text6(22) & "','" & Text2(522) & "','" & Text4 & "')", BD, adOpenStatic, adLockOptimistic
MsgBox "Agenda Guardada", vbInformation, "Éxito"
Set RecSQL = Nothing
end sub
como se pueden dar cuenta varios campos q solo cambian por el numero y se asignan a diferentes textbox q tambien cambian por nombre e index, lo q ando tratando de hacer es q al momento de guardar por ejemplo los q dicen idpaciente0,idpaciente1, idpaciente2, etc, me los guarde en otra tabla obvio en registros diferentes pero todos en un campo q se llama solamente idpaciente, espero haberme podido explicar........... de antemano gracias por sus respuestas

Saludos