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
Solved

Open RecordSet at Specific Record

Posted on 2000-03-06
8
195 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
  • 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 20 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

828 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