The found record still now shown up

F

Frank Situmorang

Hello,

This is my VBA to go directly to the record/ Minutes of meeting no found by
Combo, it already works, but since I have the Meeting date as a mother and
the Minutes of meeting report as child report, I still have to scroll down to
go to the Minutes of Meeting No on the Child. Is there any way to have it
showed up or the decision number is highlighted when we run the combo to find
it?

Private Sub Combo20_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[No_KEP] = '" & Me![Combo20] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Thanks in advance

Frank
 
T

Tom van Stiphout

On Fri, 15 May 2009 01:38:00 -0700, Frank Situmorang

Hi Frank,
First of all, I want to congratulate you on your perseverance. I have
seen your posts here over several months, and they have changed from
absolute newbie to those of someone who is getting pretty good at
putting his app together. Good for you!

A few comments about your existing code. It can be improved in several
ways. Here is my version:
Private Sub cboFindMeetingMinutes_AfterUpdate()
' Find the record that matches the control.
with Me.RecordsetClone
.FindFirst "No_KEP = '" & Me.cboMeetingMinutes & "'"
If Not .EOF Then Me.Bookmark = .Bookmark
end with
End Sub
Note how I use a descriptive name for the dropdown, and I use a
recordsetclone (shallow copy is faster than .recordset.clone which is
a deep copy) and the With block gives me automatic object cleanup at
the end.

Now to answer your question: I understand you have a Parent form with
meetings (PK = Meeting No), and a Subform with the Minutes for that
meeting. What is unclear to me is that you would have several records
in the subform: isn't there just one record with Minutes for each
Meeting? Or does your subform display all minutes for all meetings?

In general to find and select a record in a subform you use the same
technique as in a parent form. Say my Parent is a Customer record, and
my Subform lists the Orders for that Customer, and the user has just
selected a CustomerID and OrderID from a single dropdown with some
hidden columns for the IDs. I would write:
myCustomerID = Me.cboFindOrder.Column(0)
myOrderID = Me.cboFindOrder.Column(1)
with Me.RecordsetClone
.FindFirst "CustomerID = & myCustomerID
If Not .EOF Then Me.Bookmark = .Bookmark
end with
with me.mySubform.Form.RecordsetClone
.findfirst "OrderID=" & myOrderID
if not .EOF then me.mySubform.Form.Bookmark = .Bookmark
end with

-Tom.
Microsoft Access MVP
 
F

Frank Situmorang

Thanks Tom for your words of encouragement. Yes...my denominantion church
database has 3 functions:
1. membership
2. Chruch Officers
3. Church board Minutes of meeting.

All has function normally, although I still make continues improvement.

I want to make in in Dutch. From your name, probably you are Dutch?. I have
a list or words in English. If you know someone can translate it into dutch,
please inform me.

All this happened because the help of God thru all of you good people that
already helped me. Thanks to all of you.

Frank

Tom van Stiphout said:
On Fri, 15 May 2009 01:38:00 -0700, Frank Situmorang

Hi Frank,
First of all, I want to congratulate you on your perseverance. I have
seen your posts here over several months, and they have changed from
absolute newbie to those of someone who is getting pretty good at
putting his app together. Good for you!

A few comments about your existing code. It can be improved in several
ways. Here is my version:
Private Sub cboFindMeetingMinutes_AfterUpdate()
' Find the record that matches the control.
with Me.RecordsetClone
.FindFirst "No_KEP = '" & Me.cboMeetingMinutes & "'"
If Not .EOF Then Me.Bookmark = .Bookmark
end with
End Sub
Note how I use a descriptive name for the dropdown, and I use a
recordsetclone (shallow copy is faster than .recordset.clone which is
a deep copy) and the With block gives me automatic object cleanup at
the end.

Now to answer your question: I understand you have a Parent form with
meetings (PK = Meeting No), and a Subform with the Minutes for that
meeting. What is unclear to me is that you would have several records
in the subform: isn't there just one record with Minutes for each
Meeting? Or does your subform display all minutes for all meetings?

In general to find and select a record in a subform you use the same
technique as in a parent form. Say my Parent is a Customer record, and
my Subform lists the Orders for that Customer, and the user has just
selected a CustomerID and OrderID from a single dropdown with some
hidden columns for the IDs. I would write:
myCustomerID = Me.cboFindOrder.Column(0)
myOrderID = Me.cboFindOrder.Column(1)
with Me.RecordsetClone
.FindFirst "CustomerID = & myCustomerID
If Not .EOF Then Me.Bookmark = .Bookmark
end with
with me.mySubform.Form.RecordsetClone
.findfirst "OrderID=" & myOrderID
if not .EOF then me.mySubform.Form.Bookmark = .Bookmark
end with

-Tom.
Microsoft Access MVP
Hello,

This is my VBA to go directly to the record/ Minutes of meeting no found by
Combo, it already works, but since I have the Meeting date as a mother and
the Minutes of meeting report as child report, I still have to scroll down to
go to the Minutes of Meeting No on the Child. Is there any way to have it
showed up or the decision number is highlighted when we run the combo to find
it?

Private Sub Combo20_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[No_KEP] = '" & Me![Combo20] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Thanks in advance

Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top