Solved

Open RecordSet at Specific Record

Posted on 2000-03-06
8
194 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DIR issue 7 54
How to debug this code 7 61
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 47
Visual Studio search word table and return Cell index 8 61
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

773 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