Re: No Consigo Sumar El Contenido De Dos Campos String
los datos los saco de 2 tablas diferentes, en las cuales los datos numéricos están definidos como varchar los coloco en un columnViwe y a su vez quiero que me saque el total de la suma de los datos que se colocan en el mismo. Os Pongo todo el código para que lo veaís bien ya me sigo con el problema.
Public Sub Form_Open()
Dim Contador, i As Integer
Dim SubTotales As String
Me.Center
Label4.Text = "Mesa Nº"
Consultamesas.Clear
Consultamesas.Columns.Count = 4
Consultamesas.Columns[0].Text = "Consumición"
Consultamesas.Columns[0].Alignment = 1
Consultamesas.Columns[1].Text = "Cantidad"
Consultamesas.Columns[1].Alignment = 3
Consultamesas.Columns[2].Text = "precio"
Consultamesas.Columns[2].Alignment = 3
Consultamesas.Columns[3].Text = "Sub-Total"
Consultamesas.Columns[3].Alignment = 3
Label4.Text = Label4.Text & " " & Me.Number
Conectar.Connect
producto.clear
Conectar.$Res = Conectar.$Con.Exec("Select * from consumibles")
For i = 0 To Conectar.$Res.Count - 1 Step 1
Producto.Add(Conectar.$Res!producto)
Conectar.$Res.MoveNext()
Next
Conectar.Connect
Conectar.$Res = Conectar.$Con.Exec("Select * from Taula where Numero = '" & Me.Number & "'")
Contador = Conectar.$Res.Count - 1
For i = 0 To Contador Step 1
Conectar.$Res1 = Conectar.$Con.Exec("select * from consumibles where producto = '" & Conectar.$Res!producto & "'")
SubTotales = (Conectar.$Res!Cantidad * Conectar.$Res1!precio)
'SubTotal.Text = (SubTotales + SubTotal.Text)
' SubTotal.Text = (CInt(SubTotales) + CInt(SubTotal.Text))
Consultamesas.Add(i, Conectar.$Res!producto)
Consultamesas[i][1] = Conectar.$Res!Cantidad
Consultamesas[i][2] = Conectar.$Res1!precio
Consultamesas[i][3] = Conectar.$Res!Cantidad * Conectar.$Res1!precio
Conectar.$Res.MoveNext
Next
Conectar.NoConnect
End