 |
|
 |
|
Next: problem with excel
|
| Author |
Message |
External

Since: Mar 10, 2006 Posts: 26
|
(Msg. 1) Posted: Fri Mar 16, 2007 8:58 am
Post subject: DAO and ADO with Access 2002 problem Archived from groups: microsoft>public>vb>database>dao (more info?)
|
|
|
I'm trying to optimize some very old code, and I've hit a stumbling block. We
use Access as our frontend, and SQL Server as our backend.
Here's a code fragment from the old implementation of a search for a
specific record:
=================================
' Set focus to NdvID and search
API_Sleep 200
'MsgBox "DoCmd.FindRecord " & vNdvID & "," & acEntire & "," & False & ",
," & False & ", ," & True
Me.txtNdvID.SetFocus
DoCmd.FindRecord vNdvID, acEntire, False, , False, , True
API_Sleep 400
''' Verify requested NdvID was found
If CStr(Me.txtNdvID) <> vNdvID Then
If Not DoRefresh Then
''' If not found and recordset not refreshed, self-call with
refresh
Call DoFindByNdvID(vNdvID, True)
Else
''' If not found and recordset already refreshed, give failure
MsgBox "Couldn't find Individual.", vbInformation, "Search:
Failed"
End If
End If
==============================
I dont like the DoCmd.FindRecord, it takes too long, and as you can see I
need the API_Sleep their.
Here's the general idea of what I'd like to try:
==============================
If Not IsNull(vNdvID) Then
If DoRefresh Then Me.Requery
Set RS = Me.RecordsetClone
'Move first and search
If Not RS.BOF Then RS.MoveFirst
RS.FindFirst "[NdvID] = " & vNdvID
'Determine if record was found, notify if not found
If Not (RS.EOF Or RS.BOF) Then
If RS!NdvID = Val(Nz(vNdvID, -1)) Then
Me.Bookmark = RS.Bookmark
Me.cboFind = Null
Else
MsgBox "Couldn't find Individual.", vbExclamation, "Search:
EOF/BOF"
End If
Else
MsgBox "Couldn't find Individual.", vbInformation, "Search:
Failed"
End If
End If
===============================
Thats a kind of a rough idea, anyway...
The problem is that when I try to do this, I always get a type mismatch error.
I get the type mismatch, when I'm doing the assignment set RS =
Me.RecordsetClone
I take this to mean that the forms recordsource is not a DAO source, so
thats why I get the type mismatch. I looked at my database conection string
for the currentproject, and it is using SQLOLEDB. I guess that is ADO.
I have alot of questions about the database connectivity details, but my
bottom line quesstions is this: Can I use the code that I included that opens
a DAO recordset with this application?
If not, can this strategy still work?
Thanks for any help!
--
David Buttrick, SQL DBA
Parents as Teachers National Center
2228 Ball Drive
St. Louis, MO 63146
(314) 432-4330 x282
david.buttrick.TakeThisOut@parentsasteachers.org >> Stay informed about: DAO and ADO with Access 2002 problem |
|
| Back to top |
|
 |  |
External

Since: Jun 25, 2005 Posts: 348
|
(Msg. 2) Posted: Fri Mar 16, 2007 12:25 pm
Post subject: Re: DAO and ADO with Access 2002 problem [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
"David" wrote in message
> <snipped>
> Thats a kind of a rough idea, anyway...
> The problem is that when I try to do this, I always get a type mismatch
error.
> I get the type mismatch, when I'm doing the assignment set RS =
> Me.RecordsetClone
>
> I take this to mean that the forms recordsource is not a DAO source, so
> thats why I get the type mismatch. I looked at my database conection
string
> for the currentproject, and it is using SQLOLEDB. I guess that is ADO.
>
> I have alot of questions about the database connectivity details, but my
> bottom line quesstions is this: Can I use the code that I included that
opens
> a DAO recordset with this application?
> If not, can this strategy still work?
>
> Thanks for any help!
>
Your suspicions are probably correct. However, the FindRecord method of
DoCmd is entirely MSAccess dependent. DAO was once the default, then they
switched to ADO, and now I believe it has been flipped back to DAO. Can't
recall what 2002 is at the moment - but doesn't matter as it can be set to
whatever you want.
In light of this, and the fact you say you have other connectivity and
performance issues, you need to post in a MSAccess newsgroup. This group is
primarily devoted to using the DAO library within a Visual Basic
application. VBA is like, but not the same as VB.
hth
-ralph >> Stay informed about: DAO and ADO with Access 2002 problem |
|
| Back to top |
|
 |  |
| Related Topics: | Problem with DAO (Import from Excel to Access)! :( - Hi, I am novice and I have problem. I need import some data with Excel file to Access. Problem introduces as follows: In Excel(first sheet) i have data: "TYTUL" - column "A" "NAZWISKO" - column "B" "IMIE"...
problem setting "RecordSource" in Office Access 2007 ... - I have a form in Office Access 2007, the "RecordSource" property of which I;m trying to set. But first, I some background: have a push button control at the top of each column in my "overview" form that, when pressed, is supposed to ...
problem w/accessing data in a memo field in an Access 2.0 .. - I am having all sorts of trouble trying to read .bmp image data from a memo field in an Access 2.0 database. I'm in the process of upgrading one of our customers ancient Windows 3.1 systems to a new one, running the slightly less ancient Windows 2000...
VB5/DAO problem - Hi All, I have a couple of old apps in VB5 which I need to keep on working on for a little longer. (Yes, I am upgrading them to .NET). I uninstalled MS Office 97 from the machine which has VB5 installed on it, and installed MS Office 2003. VB5 is now...
dao 3.6 and Access 97 - Can I read Access 97 .mdb files with DAO 3.6 ? Thanks, Einat |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|