Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2006

Tip: Looking for answers? Try searching our database.

VBA Query returning Error Number "0"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Leo - 02 Dec 2006 06:17 GMT
Realtively new to Access programming, so bear with me. I have a database on a
server with one linked table (through the Link table wizard). I am trying to
run a query using a parameter passed from a form. I am struggling to get it
to work, and even switched from ADO to DAO. The code is below. Any
suggestions appreciated.

'Defining the recordset and setting connection
Dim dbs As Database
Dim rs As DAO.Recordset
Dim strSQL As String

Set dbs = CurrentDb

'Define SQL string for the RS
   strSQL = "Select tblNamesExtensions.[Manager], "
       strSQL = strSQL & "tblNamesExtensions.[First Name], "
       strSQL = strSQL & "tblNamesExtensions.[Last Name], "
       strSQL = strSQL & "tblNamesExtensions.[Extension], "
       strSQL = strSQL & "tblNamesExtensions.[VM Password] "
       strSQL = strSQL & "From tblNamesExtensions "
       strSQL = strSQL & "Where tblNamesExtensions.[Manager] = '" &
Me.Manager & "'" & ";"

Set rs = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
Signature

May there be no harsh in your mellow,
Leo

Allen Browne - 02 Dec 2006 06:29 GMT
If you have an error handler in this VBA procedure, and it is returning
Error 0, you have forgotten to include the:
   Exit Function
or
   Exit Sub
above the error handler.

Consequently the error code executes, even though there is no error.

Signature

Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Realtively new to Access programming, so bear with me. I have a database
> on a
[quoted text clipped - 23 lines]
>
> Set rs = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.