Look at form records from another form

nschroeder

nschroeder
Local time
Today, 14:36
Joined
Jan 8, 2007
Messages
186
I have a form (Files) with a subform (Folders). Users can check folders in and out of a file by clicking a Check In/Out button on the Files form. This opens a CheckInOut form displaying the current folder record, and they click OK to check the folder in or out. I also have an "All" checkbox on CheckInOut so they can check out all folders at once. I only want the checkbox enabled if all the folders in the current file have the same status (all In or all Out). To do this, in the CheckInOut Load event, I want to loop through the folder records and disable the checkbox if any statuses are different from the first. My problem is, I don't know how to move through the records on the Folders form from the CheckInOut form.

When it hits the "Docmd.Gotorecord" line, I get a run-time error:
"The object "Form_Folders" isn't open".

How do I change record selection on the Folders form? Thanks for your help.

Here's my code:

Private Sub Form_Load()
With Form_Folders
FolderNum.Value = !FolderNum
FolderStatus.Value = !FolderStatus
Cnt = .RecordsetClone.RecordCount
If Cnt > 1 Then ' There is more than 1 folder
TxtVal = !FolderStatus
DoCmd.GoToRecord acDataForm, "Form_Folders", acFirst
Result = 1
Do Until Result > Cnt
If !FolderStatus <> TxtVal Then
cbxAll.Enabled = False ' Statuses are not the same​
End If
DoCmd.GoToRecord acDataForm, "Form_Folders", acNext
Result = Result + 1​
Loop​
End If​
End With​
End Sub
 

Users who are viewing this thread

Back
Top Bottom