PDA

View Full Version : Multi-State Button-Only Partially Working!


ABC123

WesOlfert
03-11-2005, 05:11 PM
I have what seems to me like a really strange problem -- I have a multi-state button similar to the AlphaSports type -- to select records by first letter -- it works perfectly from A through W, but Y and Z do not work (gives messsage "No records found...") even though there are lots of names begining with Ys and Zs in the database. Anyone with an idea what might be the cause of this?

Below is my code for this Multistate button in the OnChange event: (most of this was copied from AplphaSPorts)

*************************
dim tbl as P
browse1.activate()
browse1.refresh()

topparent:tables:individuals.filter_expression = "left("+search3.text+", 1) = '" + mulstbtn1.text + "'"
topparent:tables:individuals.order_expression = search3.text
topparent:tables:individuals.query()

tbl = table.current()
i = tbl.index_primary_get()
count = i.records_get()

if count = 0
ui_msg_box("Warning", "No records found. Showing all records")
tbl.order(search3.text,search3.text + " "" \"\"")
browse1.refresh()
mulstbtn1.text = "1"
end if

'WES: The following line was added to make a-z sort on Last_Name rather than Ind_ID

'WES: The following line was added to eliminate the problem of "Maximum Number of Indexes"
tbl.query_detach_all()

'WES: Added the following to get the sort to work on "Search3" selection rather than on "Ind_ID"
parentform:Browse1.quick_sort()
***********************end code*****************

Tom Cone Jr
03-12-2005, 12:38 AM
Wes,

Double check the values in the Y and Z multi-state button. Verify that there are no leading or trailing blank spaces.

Double check the names in the Y to Z range, to rule out leading blank spaces.

-- tom

WesOlfert
03-12-2005, 03:12 AM
Dobule checked all as suggested -- there were no issues there.

I went directly to the default browse to see what was happening there, and discovered that if I did an 'a/z" sort on the Record_ID (auto-increment) field the Ys and Zs did not show up, but when I did a "z/a" sort they were there.

SO I checked the INDEXES -- where I deleted a couple of Indexes and Rebuilt All Indexes. Now eveything in working fine. So, it had something to do with the indexes but exactly what is still a mystery.