Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 2nd, 2011, 03:22 AM
Registered User
 
Join Date: Jun 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error 461

Hello,
It's my first post, so hello to everybody. I'vebeen living and working in Thailand for + than 7 years now as Deputy Principal of a school. I wrote a comprehensive school management application and I am adding new features. (VB6+ADO+SQL+MS Jet)
This code gives me an error 461 I translated from French: Compilation error Method or element cannot be found.
The element that cannot be found is rs.s_SatitID, altough I specified it in the query. I wrote a For... Next loop to see whether the field names and field values are there and they are... so I do not understand where the error comes from???
Code:
Sub ReportSatitIDToOtherTables() 

Dim strSQL As String
Dim strYear As String
Dim rs As New ADODB.Recordset
Dim adoABSMACon As ADODB.Connection
Dim Field As Object
    strYear = Right$(ThaiYear, 2)
    Set adoABSMACon = New ADODB.Connection
    Set adoABSMACon = MakeADODBConnection(adUseClient)
    adoABSMACon.Open
    strSQL = "SELECT d_SatitID, g_SatitID, s_SatitID FROM (Students INNER JOIN Students_Details ON Students.s_ASUID = Students_Details.d_SatitID) INNER JOIN Guardians ON Students_Details.d_SatitID = Guardians.g_SatitID WHERE Students.s_ASUID = Students_Details.d_SatitID AND left$(s_ASUID,2)='" & strYear & "'"    'strSQL = "SELECT s_SatitID,s_ASUID,g_SatitID,d_SatitID FROM Students, Students_Details, Guardians WHERE s_ASUID = d_SatitID AND s_ASUID=g_SatitID"
    Set rs = New ADODB.Recordset
    Set rs = MakeRecordset(adoABSMACon, adCmdText, strSQL, adOpenDynamic, adLockOptimistic)
    rs.Open
    While Not rs.EOF
'here comes the For Next I mentioned and which gives me the expected 'values
    'For Each Field In rs.Fields
        'MsgBox Field.Name
        'MsgBox Field.Value
    'Next
        rs.d_SatitID = rs.s_SatitID.Value 
'The program stops above and highlights   rs.s_SatitID[:confused:]
        rs.g_SatitID = rs.s_SatitID.Value
        rs.Update
        rs.MoveNext
    Wend
    rs.Close
    adoABSMACon.Close
    Set rs = Nothing
    Set adoABSMACon = Nothing
    
End Sub
 
Old June 2nd, 2011, 07:53 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

HI there.. although the field is there.. maybe the value is null and can't be passed??

anyway, to do what you need, probably it's easier and update query that Do all the transform inside the database directly... if that's the only you are doing with that Recordset...
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old June 2nd, 2011, 09:34 AM
Registered User
 
Join Date: Jun 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for replying, but that's not the issue.
You can see in the For... Next loop that I checked both the name and the value and both are correct, null value are not possible for that field.
 
Old June 2nd, 2011, 10:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

AHhhhh.. maybe, and probably, the recorset is not updatable.. Try to run it in your database and check if you can update it.. probably not, because the fields you are returning..
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old June 2nd, 2011, 10:32 AM
Registered User
 
Join Date: Jun 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for trying, but apparently, you don't know.
I'll find out another way.





Similar Threads
Thread Thread Starter Forum Replies Last Post
error parsing attribute 'page' & compilation error AlexW BOOK: Beginning ASP.NET 4 : in C# and VB 4 February 25th, 2011 05:01 PM
HTTP error 500: Internal Server Error in Load Testing sherin Visual Studio 2008 0 May 19th, 2010 09:02 AM
Remote Connection Error: Named Pipes Provider error hbansal ASP.NET 2.0 Basics 5 April 12th, 2009 09:51 AM
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.