?
Solved

Open RecordSet at Specific Record

Posted on 2000-03-06
8
Medium Priority
?
198 Views
Last Modified: 2012-05-04
VB Gurus,
I created a master/detail datagrid, using the dataform wizard. I want the recordset to open up at a specific record based upon the master's primary key "c_num", this value is generated and passed using a global variable("client_num") from frm_Client_Info to the Master/Detail Form, frm_All_Client_Info. Line 01 was generated by the wizard, the rest is my unsuccessful attempt to move to the specific record automatically with the form load. The code does not generate any errors it just does not work.

=====================================
Private Sub Form_Load()
(01)  Set grdDataGrid.DataSource = datPrimaryRS.Recordset("ChildCMD").UnderlyingValue

    Set db1 = OpenDatabase("C:\Database\Bacon.mdb")
    Set link = db1.OpenRecordset("Clients")

    link.MoveFirst
    Do Until link!c_num = client_num
        link.MoveNext
    Loop

    link.Close

End Sub
=====================================
Thank you.
0
Comment
Question by:diek_nf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 10

Expert Comment

by:caraf_g
ID: 2588259
Use SQL:

dim strSQL as string

strSQL = "select * from Clients where c_num >= " & cstr(client_num) & " order by c_num"

Set link = db1.OpenRecordSet(strSql)

0
 

Author Comment

by:diek_nf
ID: 2588411
caraf_g,
I was praying that would work, but it did not. I think the code generated by the data wizard is circumventing any I add in. I welcome any more assistance and thank you for your help.

diek
0
 

Author Comment

by:diek_nf
ID: 2588513
caraf_g,
Here is the code that was generated by the data wizard to open the current record.
-------------------------------------
Private Sub datPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  'This will display the current record position for this recordset
  datPrimaryRS.Caption = "Record: " & CStr(datPrimaryRS.Recordset.AbsolutePosition)
End Sub
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 10

Expert Comment

by:caraf_g
ID: 2588732
Yes, sorry... I never ever use data bound controls and I took it from that premise. I don't know how to solve the problem for those controls except to suggest you get rid of them and use normal controls. But I'm sure that's the last thing you want to hear right now...
0
 

Author Comment

by:diek_nf
ID: 2588828
caraf
Thanks for trying.
diek
0
 

Author Comment

by:diek_nf
ID: 2589841
caraf or any helpful programmer,
Please take a look at this:
This sql statement comes from a vb generated adodc component:

SHAPE {select BBINumber,First,Last from BBI} AS ParentCMD APPEND ({select Date_Interaction,InteractionAuthor,Note,Status from ClientInteraction Order by Date_Interaction } AS ChildCMD RELATE BBINumber TO BBINumber_Client) AS ChildCMD

I need to add this condition into the above SQL statement

WHERE BBINumber >= " & CStr(client_bbi_num) & "
0
 

Accepted Solution

by:
amarti earned 60 total points
ID: 2591209
For syncronize Grid Detail to Master I use Event Reposition of Master Data, that fires when Master changes.  

In that Event, you can command the Detail Grid for changing with Master primary key if also the Details has it.

DataDetail.RecordSource = "SELECT .... FROM ... WHERE NameofDetailCampForClient_Num = " &  Client_Num


0
 

Author Comment

by:diek_nf
ID: 2597601
amarti,
Sorry I didn't get back to you sooner. I've been up to my neck in work. Your solution proved helpful. Thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question