General information
Category:
Forms & Form designer
Title:
Combobox in grid with listindex = 1 ??????
Hallo everybody
I have a form with a search field, a grid, a 'new-command'
At the init of my form i define a cursor 'mycursor' depending on tableinformations
and i customize the grid depending on tableinformations
The currentcontrol of some columns is set to gridcombo and rowsourcetyp, rowsource,columncount are set
At keypress of the search field i do:
thisform.grid1.recordsource = " "
sqlexec(connection,"select * from xxx where ...",mycursor)
thisform.grid1.recordsource = mycursor
At click of the new command i do
thisform.grid1.recordsource = " "
SELECT mycursor
APPEND BLANK
*default values
replace angelegt with DATE()
replace uhrzeit with TIME()
replace benutzer with p_benutzer
FOR i = 1 TO thisform.grid1.ColumnCount
l_obj = "thisform.grid1.column" +ALLTRIM(STR(i)) + ".currentcontrol"
l_objwert = &l_obj
IF UPPER(l_objwert) = "GRIDCOMBO"
l_combo = "thisform.grid1.column" +ALLTRIM(STR(i)) + ".gridcombo"
WITH &l_combo
.listindex = 1
ENDWITH
ENDIF
ENDFOR
thisform.grid1.recordsource = mycursor
thisform.grid1.setfocus
Now my problem:
If the user has searched for some records and clicks the new command everything is OK !
Blank record in the grid with some default values, all comboboxes show the first value !!!
If the user clicks the new command without searching first there is a blank record
with default values in the grid but all comboboxes are empty ??????
They work but you have to select a value from the list ??
Whats wrong with my listindex = 1 ? Why does it only works if there are records in the grid ??
Any help welcomed
Best regards
Albert
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only