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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a Continuous Form with a tab

Status
Not open for further replies.

dgriffin

Programmer
May 26, 2001
50
US
I have a Continuous Form with a table as it's data source. I need to set the yes/no field for each record in the table when a user selects one or more of the records using the Record Selector buttons.

I have not been able to find any property that can be tested for "true" indicating that a particular record is one of the selected ones.

I am aware of the SelHeight property, but that seems to tell you only HOW MANY records are selected, not WHICH ONES.

Some detailed guidance would be greately appreciated.
 
I don't believe there is a way to do that. You want the user to select one or more records and then set a yes/no field for those records right?

If so, you may want to not use a continous form with all the records or even a bound form at all. I would use an unbound form.

Create a multiple column list box with a rowsource of the records you want to display. With the List Box, the user can select one of more of the records. You could then have a function that cycles through the select items in the list box and retrieve the record IDs of the records select. Use those IDs to perform update statements on the table.

Hope I wasn't too vague?
Pat B
 
Not the answer I was hoping for, but it is a potential solution. It's a fairly large database with 10,000+ address records with 30-40,000 maintenance records attached to the addresses.

I'm needing the "selected records" to produce selective reports and to add multiple maintenance records as a group, among other things. Off the top of my head I can't think of just how I can incorporate this approach. But it sure is a lot better than the "I don't know", "You can't" or just no response, that I have been getting til now.

Thanks for the ray of hope...

Dan
 
Will these selected groups be the same?

Will there only be a certain number of combination of records that will be reported on?

Or, as I susepct, will the combination of records potentially change every time the report is run?

I really don't think you have an easy solution to this. If you could post some additional details, maybe I or someone else could better help you.

Good Luck.
Pat B
 
The application is a Tree Inventory for a major city. The main form is a continuous form listing the trees thoughout the city that the Forestry division must trim on a rotating basis.

Each day the crew foreman prints a list of addresses that the crew is to trim that day. When they return to the office at the end of the day they must enter the maintenance records for the trees that they were able to trim that day.

When they select the group of trees to create a "Route List" each morning, there are numerous considerations that must be taken into account for the sites that will be listed on the Route List. Such that it is best done by a knowledgable, experienced person rather than the computer simply selecting the next 50 trees in sequence. This is where the use of the record selections buttons comes into play.

The record selection buttons provide the most efficient and logical means for the foreman to select the appropriate sites for the list. Because he will be selectings something like 10 sites in a row, skip 2, select 8 more, skip 1, select 22, etc.

And when it comes to various other types of reports, the selection process can incompass as many as 600 records that are selected in mish-mash groups as indicated above.

Needless to say, clicking check boxes, or even using the space-bar just isn't going to cut it as far as the user is concerned (I would probably be taken hostage!). Yet, the check box works best for the computer/programmer to deal with.

Thus the burning need to find a way to set/clear a check box in the table based on the record selections buttons that the user presses.

And in a related post (posted in the VB Code forum)... in an attempt to utilize the SelTop / SelHeight properties I incountered a curious problem with the SelHeight property. The SelTop property is set properly (to the 1st record selected), but the SelHeight property returns a zero. The following is a copy of the post:

Thanks again,
Dan


I have a continuous form (not a subform) with a table as the record source. The record selector buttons are turned on. And even though the Access Help file says "The SelHeight property. A Long Integer value between 0 and the number of records in the datasheet or continuous form.", the following code fails.

In debug I have verified that the reason it fails is because the SelHeight property is zero in spite of the fact that numerous records are selected. The SelTop property is indeed set to the first record selected as you would expect.

Any suggestions as to why the SelHeight property is zero?

==============================
Private Sub SelectButton_Click()
Dim rst As Recordset, i As Integer

If Me.SelTop > 0 Then
Set rst = Me.RecordsetClone
rst.MoveFirst
rst.Move Me.SelTop
i = 0
Do While i < Me.SelHeight
rst.Edit
rst!X = True
rst.Update
rst.MoveNext
i = i + 1
Loop
rst.Close
End If

End Sub
==============================
 
I did a quick read of this article.

1. They create public variables to hold the Form and selections.
2. Every mouse event enters a subroutine and updates the variables.
3. The public variables i.e. Form is where you need to reference the selected records.

In the above example you are using Me.variables, which have probably been reset by the time your routine is running. Try following the example and referencing the saved variables for testing record selection. Notice the code in the article restores the record selections from the saved Form variable before displaying or using.
 
Bingo!! You're my hero! Two months of struggling only to find the problem and solution to be so trivial. That's always the way. The solution to the most exasperating problems are the most innocuous.

And how did you find that article. I have searched the knowledge base 6 ways to Sunday without finding that jewel.

Thanks a million,
Dan
 
I have my best luck doing a search on one of the search engines, usually avoid the microsoft site since I find it hard to use. I did something like

+&quot;record selector&quot; +access +form

maybe some others, I can't remember for sure.

Personally, I don't have a use for the solution now, but these things are good to know since in the future this may be a solution I can use.

I am glad you finally got. I have been helped many times on this form myself.

Jerry
 
Excellent solution! I do not have a need for that right now either, but I will be saving the article.
Pat B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top