** NORMAS DEL FORO **
Inicio del foro Inicio del foro > Access y VBA > Access y VBA
  Mensajes nuevos Mensajes nuevos RSS - Incluir valores nulos en tabla referencias cruzada
  Preguntas frecuentes Preguntas frecuentes  Buscar en el foro   Eventos   Registro Registro  Iniciar sesion Iniciar sesion

Tema cerradoIncluir valores nulos en tabla referencias cruzada

 Responder Responder
Autor
Mensaje
Jorge33 Ver desplegable
Habitual
Habitual


Unido: 09/Abril/2019
Localización: madrid
Estado: Sin conexión
Puntos: 58
Enlace directo a este mensaje Tema: Incluir valores nulos en tabla referencias cruzada
    Enviado: 29/Mayo/2019 a las 11:33
Buenos dias:

Tengo una consulta de referencias cruzadas. 
Sólo aparecen los datos que tienen algún valor pero yo necesitaría que aparezcan todas las columnas correspondientes aunque no tengan ningún valor asociado.
¿Como podría hacerlo?

Muchas gracias
< x="0" y="0" width="99999" height="99999" id="hc_extension_off">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black_back">
Arriba
Mihura Ver desplegable
Administrador
Administrador
Avatar

Unido: 06/Mayo/2005
Localización: En la dehesa
Estado: Sin conexión
Puntos: 13990
Enlace directo a este mensaje Enviado: 29/Mayo/2019 a las 12:28
Tendrías que modificar la PIVOT

... PIVOT xxxx IN (1, 2, 3, 4)
Jesús Mansilla Castells.
Saludos desde Móstoles.

Access Aplicaciones
Tecsys.es
Arriba
Jorge33 Ver desplegable
Habitual
Habitual


Unido: 09/Abril/2019
Localización: madrid
Estado: Sin conexión
Puntos: 58
Enlace directo a este mensaje Enviado: 29/Mayo/2019 a las 12:38
Muchas gracias
Funciona perfectamente.  Que aparezca un cero en vez de un espacio vacío supongo que ya será más difícil.
< x="0" y="0" width="99999" height="99999" id="hc_extension_off">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black_back">
Arriba
Mihura Ver desplegable
Administrador
Administrador
Avatar

Unido: 06/Mayo/2005
Localización: En la dehesa
Estado: Sin conexión
Puntos: 13990
Enlace directo a este mensaje Enviado: 29/Mayo/2019 a las 13:15
Tendrás que modificar la consulta para que muestre ceros en vez de blancos ...
Jesús Mansilla Castells.
Saludos desde Móstoles.

Access Aplicaciones
Tecsys.es
Arriba
fcoval Ver desplegable
Asiduo
Asiduo


Unido: 19/Enero/2013
Estado: Sin conexión
Puntos: 225
Enlace directo a este mensaje Enviado: 29/Mayo/2019 a las 18:26
Publicado originalmente por Jorge33 Jorge33 escribió:

Muchas gracias Funciona perfectamente.  Que aparezca un cero en vez de un espacio vacío supongo que ya será más difícil


Como bien dice Mihura, tendrás que modificar la consulta y usar Nz


Nz(TUCAMPOVALOR);0)
Arriba
Jorge33 Ver desplegable
Habitual
Habitual


Unido: 09/Abril/2019
Localización: madrid
Estado: Sin conexión
Puntos: 58
Enlace directo a este mensaje Enviado: 30/Mayo/2019 a las 09:08
Gracias.
He probado:
 SiInm(EsNulo([Id])=Verdadero;"0";[Id])
 y 
Nz( [Id];0) 
pero no me funciona. ¿está mal la sintaxis?
< x="0" y="0" width="99999" height="99999" id="hc_extension_off">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black_back">
Arriba
mounir Ver desplegable
Colaborador
Colaborador


Unido: 09/Febrero/2009
Localización: Asturias-España
Estado: Sin conexión
Puntos: 6479
Enlace directo a este mensaje Enviado: 30/Mayo/2019 a las 09:53
Hola!

SiInm(EsNulo([Id]);"0";[Id])

ó

Nz ([Id];0) >>> quitando el espacio que hay entre la paréntesis y el campo [Id]



Método Aplicación.Nz y SiInm












Editado por mounir - 30/Mayo/2019 a las 09:55
Un Saludo.
Arriba
Jorge33 Ver desplegable
Habitual
Habitual


Unido: 09/Abril/2019
Localización: madrid
Estado: Sin conexión
Puntos: 58
Enlace directo a este mensaje Enviado: 26/Noviembre/2019 a las 08:31
No he logrado que funcione ninguna de las 2 pero lo he conseguido haciendo una consulta sobre esa consulta y ya funciona.

Muchas gracias.

Se puede cerrar el tema.
< x="0" y="0" width="99999" height="99999" id="hc_extension_off">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black_back">
Arriba
 Responder Responder
  Compartir tema   

Ir al foro Permisos de foro Ver desplegable