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

Select the desired records using checkbox 1

Status
Not open for further replies.

jflo

Programmer
Mar 13, 2001
44
0
0
CA
I have a form that presents all the parts ordered like a report would do in a detail section. I have a "delivered" checkbox for every record. I want to be able to check as many checkbox of parts I'm delivering and when I click "Done", the code behind the form treats all the records modified. Right now, it's only treating the "current" record. I guess I could close the form so it saves the data in the table and call another func or sub to finish the work but there must be a way to acheive what I'm trying to do.

TIA

J-F
 
What do you mean by "TREAT" ?

If I understand you right - you have a "Continuous Form" view. Therefore, as you click the second record's 'delivered' tick box Access saves the first record automatically. By the time you click on the "Done" button the only record left to update IS the 'current' record.

You could then open a recordset using
"WHERE [Delivered] = True"
in the Where clause and then cycle through the records in the recordset.

Does that help?


G LS
 
By "TREAT" I ment to work on it, to do something with it.

And Yes I have a continuous form view that looks like this:

[] partOne descriptionOne
[] partTwo descriptionTwo
[] partThree descriptionThree
[] and so on,

[Back button] [Done button]
I usualy have more then ten records. What I have now is I get all the selected records but the current one. There must be a way of forcing Access to save the info of the current record.

I want to be able to circle throught the selected records, check the part number and do diffrent things depending on the part number. Right now, if there's only one record selected, I get an error message that there's no record using "MoveLast" to get the recordcount. I'm using a SQL statement to open a dynaset in order to modify some of the records found. Here's what I have

Set db = CurrentDb()

strSQL = "SELECT * FROM tblPartNo WHERE Delivered = -1"

Set tblPartsOrdered = db.OpenRecordset(strSQL,dbOpenDynaset)

tblPartsOrdered.MoveLast
If Not tblPartsOrdered.NoMatch Then
Do Until tblPartsOrdered.EOF
'Do what ever I need to do here

If I have three records selected, recordcount = 2.

Am I making more sens? How would you do it? I can start all over if there's a much better way. I can't be the first one who tries to design this type of form.

Thanks
 
You need to add a protection line to prevent attempts to move beyond the last record


Set tblPartsOrdered = db.OpenRecordset(strSQL,dbOpenDynaset)

IF tblPartsOrdered.EOF Then
' do something appropriate because there are no records.

tblPartsOrdered.MoveLast



G LS
 
Yes but how do I get recordcount = 1 if I have one record?

I want the last record (or the only one in this case) checked to be saved in the table prior to query it in order to have the entry in the table.

 
Arr. You're getting one less record in the record set that the number of ticks on the form .. .. Because the last ( current) record's tick is not stored into the underlying table. You need to requery the data before you do anything else. Then your record count will be correct and you'll be able to do the things you want.


G LS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top