Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform SelHeight and SelWidth Always Zero

Status
Not open for further replies.

fuzzyocelot

Programmer
Joined
Jul 22, 2003
Messages
333
Location
US
I am running Access 2003 on Windows XP Professional 2002 (SP2).

I have a form which contains two datasheet subforms. Both subforms are bound to different tables. They are not linked together. I want to be able to find out how many rows the user has selected from each subform. I really want to make sure they only select one at a time.

I was using the code in an older thread (thread705-671178) and it helps except for one thing. It seems that no matter what I do, the frm.SelHeight and frm.SelWidth values are always 0. The frm.SelTop and frm.SelLeft return values, though. Does anyone have any ideas as to what I'm doing wrong or what I need to do in order for the SelHeight and SelWidth properties to return values?

Thanks!
 
Hi GingerR!

I tried using a listbox first, but I ran into some problems there as well. One of them being I couldn't get the horizontal scroll bar to work. It would not move no matter what I did. I made sure the width of the columns exceeded the width of the list box. Also, I believe I would have to do quite a bit of coding to get the listboxes to do what I want.

It's kind of complicated to explain but basically the first list/subform contains a listing of unmatched addresses from a file that is imported on a regular basis. The second list/subform contains a listing of known addresses. The user has to match the rows from the first list with the second one. My plan is that once they've selected one row from each list/subform, then they will click a button and those two rows will be inserted into a cross reference table. That way if the unmatched address finds its way into the import file again, then I can check it against this cross reference table and match it up with the correct address. I hope this makes sense.

Unfortunately, the user has to do this manual matching because data entry errors are very common in these addresses that are in the import files, and I can't find a way to programmatically match them up with 100% certainty.

I really appreciate any help or advice anyone has.

Thanks!
 
I finally figured it out! Yay! :D

When I click the "Select" command button after selecting one or more rows on the subform, the subform loses focus which means the SelHeight value is no longer "valid". So I have to save the SelHeight value to a global variable when the user clicks the subform (record selector) and then read it when someone clicks the "Select" button. Hope I explained it right.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top