Link to home
Start Free TrialLog in
Avatar of Pabilio
PabilioFlag for Spain

asked on

UPDATE SQL FROM EXCEL

I think that I posted this tread in the wrong places...
So let´s see if here at VB I could find a good soul who could help me.

Attached is the spreadsheet that I´m working with, which have some macros in it to allow the user to create a New Final Tax Report according to my Country Regulations.

The RED Sheet (DATOS) is filled with the get external data tool in excel from My Data Base (CEDRO)

The formulas in the GREEN Sheet (CAMBIAR AQUI) are made in the way to determinate if there is wrong entrys in the Data Base before to Print the Final TAX report in the Blue Sheet (LIBRO DE IVA)

The original SQL that I Copy from the MSQUERY to import the data is as Follows:

SELECT cast(CONVERT(varchar(8), B.FechaE, 112) AS datetime) , B.NumeroD, B.Descrip, B.ID3, B.Monto, B.MtoTax, B.RetenIVA, A.TipoCli, A.EsGranCont, B.CodUsua, B.CodVend
FROM CEDRO.dbo.SACLIE A, CEDRO.dbo.SAFACT B
WHERE A.CodClie = B.CodClie AND ((B.FechaE Between ? And ?) AND (B.TipoFac Between ? And ?))
ORDER BY cast(CONVERT(varchar(8), B.FechaE, 112) AS datetime), B.NumeroD

What I need is to give the user the chance to update the field ID3 (Column D in DATOS Sheet) and then with a Button UPDATE the SQL  TABLES: SACLIE and SAFACT (Both Tables linked by CodClie (KEY) and the ID3 which is the field I need to Change.

Other Info:
SERVER NAME: SERVIDOR
DATA BASE: CEDRO
TABLES: SACLIE (Main Table...contains all Customer Details) and SAFACT (Contains Invoice Info)
WORKBOOK NAME: CREAR NUEVO LIBRO DE VENTAS

I´m really new in VB features...some superficial knoledge only and even when I find some similar situations here I´m not able to use it in my case...If you can help me please do it...I´ll put your picture as my default desktop
CREAR-NUEVO-LIBRO-DE-VENTAS-CORR.xls
Avatar of borgunit
borgunit
Flag of United States of America image

Not quite sure what you need but maybe have a user form with some text fields that a user can fill in and then use a command button to start the update. From there use your database connection and then use the sql UPDATE someTable SET someField=someInfo WHERE someField=someOtherInfo. Is this helpful?
Avatar of Pabilio

ASKER

Hi Borgunit,

That is exactly what I need.

I need the Command Button you said in the Sheet DATOS or in a new Sheet as the User Form you mention (That would be great !!!).

If you can help me to do this please send me your picture to use it as my default Desktop.  :-)

Regards,
Roberto.
ASKER CERTIFIED SOLUTION
Avatar of Pabilio
Pabilio
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial