Page 1 of 1

COMBOBOX with oDBF

Posted: Wed Jan 03, 2007 8:07 pm
by Ollie
I want to store 'L', 'A' or 'O' in a (1 character) database field called MAIL_CAT (Mail category = Local, African, Overseas)

But I want to use a Combobox so the user can only make a valid choice, but I only want to store the first letter ie. L, A, or O in the database.

REDEFINE COMBOBOX oDBF:MAIL_CAT ITEMS {"Local", "African", "Overseas" } ID 4012 OF oDLG

... doesn't do it.

Is there a way the screen can show 'Overseas' when it sees 'O' in the database field? How?

Posted: Wed Jan 03, 2007 8:22 pm
by James Bott
Use a DBCombo. See \samples\testdbc1.prg for an example.

Posted: Wed Jan 03, 2007 8:41 pm
by Ollie
Thanks.

I have this code:

REDEFINE DBCOMBO oDBF:MAIL_CAT ID 4012 ;
items {"L","A","O"} ;
list {"Local","African","Overseas"} ;
of oFld:aDialogs[ 1 ] UPDATE

But the compiler gives a "parse error at 'DBCOMBO' what am I doing wrong?

Posted: Wed Jan 03, 2007 8:58 pm
by James Bott
#include "dbcombo.ch"

Posted: Wed Jan 03, 2007 9:11 pm
by Ollie
That did it. EXCELLENT !!! Thanks.