FoxPro/Visual FoxPro - AYUDA PORFAVOR

 
Vista:

AYUDA PORFAVOR

Publicado por PEDRO (3 intervenciones) el 02/03/2007 14:56:15
PENSE QUE PODIA HACER ESTO PERO NO PUEDO EN UN ROW SOURCE DE UN COMBOBOX ME DICE QUE THISFORM SOLO SE PUEDE UTILIZAR EN UN METODO Y LA VERDAD LO NECESITO ASI
SELECT * FROM CIUDAD WHERE DEPARTAMEN=VAL(THISFORM.cmbdepartamento.VALUE)

O SI ME PUEDEN DAR OTRA IDEA ESTARE MUY AGRADECIDO ESTO ES LO QUE QUIERO MOSTRAR

DOS TABLAS
CIUDAD DEPARTAMENTO
DESCR DESCR
CIUDAD

Y CUANDO LE PÒNGA EL DEPARTAMENTO LA IDEA ES QUE ME CARGUE NADA MAS LAS CIUDADES DEL DEPARTAMENTO QUE PUSE EN EL COMBO POR ESO LA INSTRUCCION

BUENO ESTOY MUY NUEVO EN ESTO LLEVO UN AÑITO Y CUALQUIER AYUDA ESTARE MUY AGRADECIDO
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:AYUDA PORFAVOR

Publicado por neo (1604 intervenciones) el 02/03/2007 15:14:13
Select 1
use tabla_depto.dbf

Select 2
use tabla_ciudad.dbf

select 2
Locate for tabla_ciudad.num_ciudad=Thisform.combo1.value
If found() then
set filter to num_ciudad=Thisform.combo1.value
else
endif

Set filter to

*** Tomando en cuenta que la validacion y condicion sea por numero, es decir, que el num de depto sea igual al num de ciudad.

Tabla depto:
num depto

1 depto1
2 depto2
3 depto3

Tabla ciudad:
num ciudad

1 cualquiera
2 cualquiera2

Quedando asi:

num depto ciudad
1 depto1 cualquiera
2 depto2 cualquiera2

Espero sea de ayuda.

suerte►
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:AYUDA PORFAVOR

Publicado por PEDRO (3 intervenciones) el 02/03/2007 16:02:53
QUE PENA QUITARLES TIEMPO Y ESPERO QUE ME TENGAN PACIENCIA
Select 1
use tabla_depto.dbf
Select 2
use tabla_ciudad.dbf
select 2
Locate for tabla_ciudad.num_ciudad=Thisform.combo1.value =DEPARTAMENTO
If found() then
set filter to num_ciudad=Thisform.combo1.value
else
endif
LA INSRUCCION DICE LOCALIZE NUM.CIUDAD EN LO QUE TENGA EN EL NUM.DEPARTAMENTO
Y NO SON IGUALES PORQUE UN DEPARTAMENTO PUEDE TENER VARIAS CIUDADES
LAS TABLAS VIENEN ASI EXACTAMENTE

TABLA CIUDAD:
CIUDAD
DESCRIPCION

TABLA DEPARTAMENTO:

DEPARTAMENTO
DESCRIP

Y CON RESPECTO AL VAL CLARO QUE SI DA PERO POR EJEMPO PARA UNA CONSULTA SQL O UN GRID PERO NO PARA UN COMBO PORQUE DICE QUE EL ROWSOURCE NO PUEDE TENER PORQUE DICE QUE SOLAMENTE SE PUEDE HACER EN UN THISFORM EN UN METODO

LA VERDAD QUE PENA CON USTEDES GRACIAS POR LA ATENCION PRESTADA
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:AYUDA PORFAVOR

Publicado por Alberto Castillo (13 intervenciones) el 02/03/2007 15:45:22
Ese error me ha pasado y lo unico q he tenido q hacer es publicar la variable por la cual hago mi select en tu caso seria la variable VAL

ojala te ayude
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:AYUDA PORFAVOR

Publicado por PEDRO (3 intervenciones) el 02/03/2007 16:48:50
QUE PENA QUITARLES TIEMPO Y ESPERO QUE ME TENGAN PACIENCIA
la instruc
Select 1
use tabla_depto.dbf
Select 2
use tabla_ciudad.dbf
select 2
Locate for tabla_ciudad.num_ciudad=ciudad=Thisform.combo1.value =departamento
If found() then
set filter to num_ciudad=Thisform.combo1.value
else
endif
LA INSRUCCION DICE LOCALIZE NUM.CIUDAD EN LO QUE TENGA EN EL NUM.DEPARTAMENTO
Y NO SON IGUALES PORQUE UN DEPARTAMENTO PUEDE TENER VARIAS CIUDADES
con respecto a lo del val claro que da pero para por ejemplo una instruccion sql o un grid
pero para un combo no dice que thisform nada mas puede ir en un metodo
LAS TABLAS VIENEN ASI EXACTAMENTE
TABLA CIUDAD:
CIUDAD
DESCRIPCION

TABLA DEPARTAMENTO:
DEPARTAMENTO
DESCRIP
CIUDAD
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

RE:AYUDA PORFAVOR

Publicado por neo (1604 intervenciones) el 02/03/2007 17:07:30
entonces te recomiendo que uses un campo llamado No_ciud, como numerico, algo asi:

Tabla Ciudad:

No_ciudad Ciudad Descripcion
1 x1 xxx
2 x2 xxx
3 x3 xxx

Tabla Departamento:
Departamento Descripcion No_Ciudad Ciudad
xxxx xxxxxxx 1 x1
xxxxx xxxxxx 2 x2

entonces, emplea el codigo que te pase hace rato.

Aqui, lo mejor es relacionarla por medio de un valor numerico, las opciones de relacionar una tabla y otra solo es cuestion de pensar un poco. Pre te recomiendo que el valor sea numerico al tratar de relacionar dos tablas.

Yo lo hago de esa manera y siempre me ha funcionado full.

Suerte►
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar