La vista se llama Notasdia y le tengo que añadir el siguiente campo: Notas_Venta.Pabellon
He hecho lo sieguiente que es como se haría en SQL Server, pero me da error en ambas ejecuciones, con no sé qué de DROP TABLE y CREATE TABLE.
Código:
Si me pudierais indicar como hacer que esto funcione, os lo agradecería muchísimo, o en su defecto como modificar la consulta de access desde VB6.SQL = "" SQL = "DROP VIEW Notasdia" dbBaseDeDatos.Execute (SQL) SQL = "" SQL = "CREATE VIEW Notasdia AS" SQL = SQL & "SELECT DISTINCTROW Notas_Venta.NV_FSubasta, Detalle_Nota.Número, Notas_Venta.NV_NSubasta, Detalle_Nota.DN_Linea, Detalle_Nota.DN_Talla, Detalle_Nota.DN_Presentacion, Detalle_Nota.DN_Calidad, Detalle_Nota.DN_Destino, Notas_Venta.Bu_Matricula, Detalle_Nota.Co_Codigo, Notas_Venta.Pu_Codigo, Notas_Venta.NV_FDesem, [DN_CAJAKILO]*[DN_PESOCAJA] AS Peso_total, Detalle_Nota.DN_Total AS Importe_total, Detalle_Nota.DN_ImpUnid, Especies.Es_CodigoSIP, Compradores.Co_NIFCIF, Detalle_Nota.DN_CarAbo, Buques.Ar_NIFCIF, Notas_Venta.Identificador, Notas_Venta.Permex, Notas_Venta.Zona, Notas_Venta.Arte, Vendedores.Ve_Nombre, Notas_Venta.RefContrato, Notas_Venta.IdDocumento, Notas_Venta.Documento, Notas_Venta.IdProcedencia, Compradores.Co_Nombre, Vendedores.Ve_NombreL, Notas_Venta.ListaBuque, Notas_Venta.MatriculaBuque, Notas_Venta.FolioBuque, Notas_Venta.Pabellon" SQL = SQL & "FROM (Buques INNER JOIN (Especies INNER JOIN (Compradores RIGHT JOIN (Notas_Venta INNER JOIN Detalle_Nota ON (Notas_Venta.NV_FSubasta = Detalle_Nota.NV_FSubasta) AND (Notas_Venta.NV_NSubasta = Detalle_Nota.NV_NSubasta)) ON Compradores.Co_Codigo = Detalle_Nota.Co_Codigo) ON Especies.Es_Codigo = Detalle_Nota.Es_Codigo) ON Buques.Bu_Matricula = Notas_Venta.Bu_Matricula) INNER JOIN Vendedores ON Notas_Venta.Ve_Nombre = Vendedores.Ve_Nombre" SQL = SQL & "ORDER BY Notas_Venta.NV_FSubasta DESC , Notas_Venta.NV_NSubasta, Detalle_Nota.Número" dbBaseDeDatos.Execute (SQL)
Gracias y un Saludo!