Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Accessing Recordset for Data Control

Posted on 2002-06-24
9
Medium Priority
?
153 Views
Last Modified: 2013-11-25
I have a dbCombo box that uses the objAcctInfo1 datacontrol.  I want to be able to select a name from the combo box and then when I press a button, it will set the variable strTitle1 to the Title for that name in the database...my problem is that when I debug this code it is always at the first record of the recordset, not at the record I need.  I just need to know how to move the pointer to the record I need...what would I add to this code to do that?  It would need to point to the record where cboName = the Name field in the objAcctInfo1 data control recordset.

With Me.objAcctInfo1.Recordset
.OpenRecordset
 strTitle1 = ![Title]
.Close
End With

Thanks,

Zippy221
0
Comment
Question by:zippy221
9 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 7104126
You don't need to re-open and close the recordset each time, this will reset to the first record:

With Me.objAcctInfo1.Recordset
strTitle1 = ![Title]
End With
0
 

Expert Comment

by:mudasir_ahmed
ID: 7104205
Hi Zippy,
  Try moving to the record using .Movenext or .Move (Record Number).

-Mudasir.
0
 

Author Comment

by:zippy221
ID: 7104290
How do I know what the record number is?
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.

 

Author Comment

by:zippy221
ID: 7104293
I tried leaving out the close and open recordset, but that doesn't seem to work either...
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7104650
using text property of dbcombo?
0
 

Author Comment

by:zippy221
ID: 7105462
That doesn't work either...here is what I tried:

Dim strTitle1 As String
Dim SearchCriteria1 As String

SearchCriteria1 = "[Employee]= " & Chr$(34) & cboAccountInformation1 & Chr$(34)

With Me.objAcctInfo1.Recordset
    .FindFirst SearchCriteria1
    strTitle1 = ![Title]
End With

When I debug it the search criteria is okay, but the title doesn't change it is still not moving to the record it is on...
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 280 total points
ID: 7105523
Well, not use Double quotes:
SearchCriteria1 = "[Employee]= '" & cboAccountInformation1 & "'"
0
 

Author Comment

by:zippy221
ID: 7114220
You are a awesome!  Thanks!

0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7114325
yeah, yeah, i know :)))
Thanks for "A" grade!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

927 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