[AccessD] ADO Query (this time?!?) <SOLVED>

Sad Der accessd666 at yahoo.com
Fri Sep 19 02:02:49 CDT 2003


AAHHRGG thank god it's almost weekend.
Check the where clause:
WHERE
[tblSource].[ID]=[Forms]![fInterface]![lblID].Caption;"

according to my sql tblSource.ID equals the text:
[Forms]![fInterface]![lblID].Caption

i changed the where clause and it works like a charm!

Regards,

SD
--- Sad Der <accessd666 at yahoo.com> wrote:
> Hi group,
> 
> for the last 1,5 hour I'm trying to create an ADO
> recordset....
> 
> What the hell is wrong with the code below?
> I use a function called GetStatus to run a query and
> send me the results back...shouldn't be that
> complex?!
> 
> When I call it like this:
> gstrSwitchStatus = GetStatus("qrySwitchStatus")
> 
> I keep getting the error:
> Invalid SQL-statement; expected DELETE, INSERT,
> PROCEDURE, SELECT, or UPDATE.
> 
> Or when I call it like:
> (this is the sql-code of the query!)
>     strSQL = "SELECT [tblSource].[Status] AS
> qryStatus
> " & _
>               "FROM tblSource " & _
>               "WHERE
>
[tblSource].[ID]=[Forms]![fInterface]![lblID].Caption;"
>     
>     gstrSwitchStatus = GetStatus(strSQL)
> 
> I get the error:
> No value given for one or more required parameters
> I call the function as follows:
> 
> ...and here is the function:
>  Public Function GetStatus(qryName As String) As
> String
> 
> 
>   Dim strRtn As String
>   Dim conn As ADODB.Connection 'db connection
>   Dim rst As ADODB.Recordset 
> 
> ' On Error GoTo GetCount_ERR
> 
>   strRtn = "FAILED"
>  
>   Set conn = CurrentProject.Connection
>   Set rst = New ADODB.Recordset
>   With rst
>     .ActiveConnection = conn
>     .Source = qryName
>     .LockType = adLockOptimistic
>     .CursorType = adOpenDynamic
>     .Open
>   End With
>  
> ' rst.Open qryName, conn, adOpenStatic,
> adLockReadOnly
> ...
> ...
> 
> PLEASE HELP ME OUT!
> 
> TIA
> 
> SD
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> http://sitebuilder.yahoo.com
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


More information about the AccessD mailing list