DoCmd Open recordset

driver7408

Registered User.
Local time
Today, 01:07
Joined
Feb 7, 2010
Messages
72
Here's an easy one, although I've never had to do this before so I am a bit unsure.

I have a continuous form that lists a group of records in a main form based on a query. On each line of this continuous form, there is a button that can be clicked to open the main form based on that record.

Code:
DoCmd.OpenForm "frmRAW", , , "[frmRAW].[FID]= " & Me.FID.Value
This works fine, although it filters the recordset to just that one record.

What else do I need to apply the same recordset that is in the continuous form, so the user can also scroll through the records on the main form if they so wish to?

I want them to be able to click on the button in the continuous form, open the form to that record, but also give them the ability to scroll to the other records that were listed in the continuous form. The continuous form I mentioned is its own form seperate from the main form.
 
If I understand you correctly:

In the calling, Continuous Form:

Code:
Private Sub cmdYourButtonName_Click()
   DoCmd.OpenForm "frmRAW", , , , , , Me.FID
End Sub

In frmRAW:

Code:
Private Sub Form_Load()
 If Len(Nz(Me.OpenArgs, "")) > 0 Then
   FID.SetFocus
   DoCmd.FindRecord Me.OpenArgs
 End If
End Sub
Linq ;0)>
 
If I understand you correctly:

In the calling, Continuous Form:

Code:
Private Sub cmdYourButtonName_Click()
   DoCmd.OpenForm "frmRAW", , , , , , Me.FID
End Sub

In frmRAW:

Code:
Private Sub Form_Load()
 If Len(Nz(Me.OpenArgs, "")) > 0 Then
   FID.SetFocus
   DoCmd.FindRecord Me.OpenArgs
 End If
End Sub
Linq ;0)>

Thank you,

I want to not only go to the record, but also set the main forms recordsource as the same recordsource that the continuous form's query uses, when the main form opens. I would assume the recordsource is specified by the continuous form onclick event of the button on the continuous form.

The recordsource for the main form just needs to be filtered to show the same records that exist in the continuous form.

IE: User looks at continuous form and sees a list of filtered records, say 7 of the 120 that are in the database. He clicks on the button next to the record he wishes to view. Main form opens to that record. On main form he can also scroll to those other 7 records, as these records are filtered to be the same 7 records that he saw in the continuous form. Continuous form is a seperate form from the main form. No Subforms are involved in this.
 
Last edited:
Filtering forms on open can be confusing. I think what you're after is:
Code:
DoCmd.OpenForm "frmRAW"
[Forms]![frmRAW].Filter = "[frmRAW].[FID]= " & Me.FID.Value
[Forms]![frmRAW].FilterOn = True
although I'm morbidly curious why you need to have two synchronized forms open to multiple records... can you expand on the business process a bit?
 
Filtering forms on open can be confusing. I think what you're after is:
Code:
DoCmd.OpenForm "frmRAW"
[Forms]![frmRAW].Filter = "[frmRAW].[FID]= " & Me.FID.Value
[Forms]![frmRAW].FilterOn = True
although I'm morbidly curious why you need to have two synchronized forms open to multiple records... can you expand on the business process a bit?


The form (frmRAW) is for entering a risk assessment. Once all of the information is entered into, it is later checked off by a supervisor. So I have a table full of risk assessments (tblRAW) that are created by this form (frmRAW). Some are approved, some are not.

The supervisor opens the Options form (frmRAWSelect). This form has a continuous subform within it (frmAAprove). This subform recordsource is based on a query. This query lists all of the records of the risk assessments that have not yet been approved by the supervisor.The supervisor can see each RAW record that is waiting for him to sign off on, listed in this continuous form. He can click on the record and it will open in the (frmRAW), and he can then sign off on it.

It works now, but when it opens to the form (frmRAW) for him to sign off on, he can only view that record. He can sign it off, but then he has to close the form and go back and select another one from the (frmAAprove) form, if he wants to see a different record that hasn't been signed off.

Instead of this, I would like it to open up to the (frmRAW) to the record that he picked, but also have the ability for him to scroll through the other records that he hasn't approved yet, instead of having to close the (frmRAW) and go back to the (frmAApprove) to pick another record.

When he opens the (frmRAW), I want the record selector at the bottom to show all the same records that were available from the query of the (frmAApprove), so if he wants to scroll through them and sign the rest of them off, he can without having to go back and pick them individually from the (frmAAprove)

I need the clock event from the continuous form to do two things:

1.Open the form and go to the selected record,
2. Once the form is open on that record, allow the user to scroll to the other records within the form that have not been signed off yet.


I don't know any better way to explain this.
 
Last edited:
Yeah, .Filter is going to be the way to go. It'll keep him from having to close/reopen all the time.
 
Ive figure out how to go to the record, and I've figured out how to apply the filter, but I cannot figure out how to do both.
 
This bit of code from PBaldy's website seems to work. I only added the query at the DoCmd Open and its filtering properly now.

Code:
Private Sub Command13_Click()

Dim rs As Object
Dim lngBookmark As Long

lngBookmark = Me.FID
DoCmd.OpenForm "frmRAW", , "qryCDRSign"
Set rs = Forms!frmRAW.RecordsetClone
rs.FindFirst "FID = " & lngBookmark

Forms!frmRAW.Bookmark = rs.Bookmark
 
End Sub
 

Users who are viewing this thread

Back
Top Bottom