Access VBA, SQL Statement, Update, Table = variable, error
Publicado por Genaro (17 intervenciones) el 04/04/2017 17:13:51
Hello friends....
I'm trying to update 2 camps in one table.
IMPORTANT: Table name is a variable named TT, that adquieres it values from a condition if then end
I just need to update the fields....
I'm trying to update 2 camps in one table.
IMPORTANT: Table name is a variable named TT, that adquieres it values from a condition if then end
I just need to update the fields....
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Private Sub ImprimirFactura_Click()
If Me.Whatsapp & 99 = 99 And Me.Identificador & "99" = "99" Then Exit Sub
'BUSCAR si esta consulta ya tiene un NCF de algún tipo
Dim DBNCF As DAO.Database
Dim RSNCF As DAO.Recordset
Dim RS As DAO.Recordset2
Set DBNCF = CurrentDb
Set RSNCF = DBNCF.OpenRecordset("RS_NCF")
Set RS = DBNCF.OpenRecordset("Consulta_SubTotales")
RSNCF.MoveLast
RSNCF.MoveFirst
RSNCF.FindFirst "Id = " & Forms!VentaRapida!Id & ""
If RSNCF.NoMatch Then
Else
RS.MoveLast
RS.MoveFirst
RS.FindFirst "Id = " & Id & ""
'If RS!SumaDeSubT_ITBIS - RSNCF!ITBIS > 0.01 Then NCFV_Update
If RSNCF!TipoNCF = "Facturas que generan Crédito y Sustentan Costos y/o Gastos" Then TT = "NCF-VCF"
If RSNCF!TipoNCF = "Facturas para Consumidores Finales" Then TT = "NCF-CF"
If RSNCF!TipoNCF = "Regímenes Especiales de Tributación" Then TT = "NCF-RE"
If RSNCF!TipoNCF = "Comprobantes Gubernamentales" Then TT = "NCF-Gob "
DBNCF.Execute "Update NCF-CF Set [ITBIS] = ITBIS, [Sub-Total] = SubTotal Where Id = @" & Id & ";"
DoCmd.RunSQL "Update NCF-CF Set [ITBIS] = ITBIS, [Sub-Total] = SubTotal Where Id = @" & Id & ";"
End If
Valora esta pregunta


0