Coding Thread, VB6 Help in Coding and Web Development; I have an application which is failing, and it appears to be this line of code:
Code:
dataCustomers.Recordset.MoveFirst = "SELECT ...
-
17th April 2009, 08:58 AM #1 VB6 Help
I have an application which is failing, and it appears to be this line of code:
Code:
dataCustomers.Recordset.MoveFirst = "SELECT * FROM tbl_customers,tbl_join WHERE tbl_join.isbn = '" & txtBook(0).Text & "' AND tbl_join.membership_number = tbl_customers.membership_number"
This is error I am getting:
Code:
Compile error:
Expected Function or variable
Any ideas?
-
-
IDG Tech News
-
17th April 2009, 09:02 AM #2 MoveFirst is a function, not a variable, so you can't assign things to it.
-
-
17th April 2009, 09:07 AM #3 
Originally Posted by
powdarrmonkey
MoveFirst is a function, not a variable, so you can't assign things to it.
So how would I go about opening the first recordset that matches that SQL?
Still newish to VB6
-
-
17th April 2009, 09:12 AM #4 You need to use OpenRecordset to open the table...
Code:
Dim dbMyDB As Database
Dim rsMyRS As RecordSet
Set dbMyDB = OpenDatabase("MyDatabase.mdb")
Set rsMyRS = dbMyDB.OpenRecordSet("MyTable", dbOpenDynaset) ...and then do some operation, like FindFirst, Filter, MoveNext, etc. Think of a recordset like a row of shelves that you can walk around.
(I'd also stop using VB6 and use .Net
)
-
-
17th April 2009, 09:18 AM #5 
Originally Posted by
powdarrmonkey
You need to use OpenRecordset to open the table...
Code:
Dim dbMyDB As Database
Dim rsMyRS As RecordSet
Set dbMyDB = OpenDatabase("MyDatabase.mdb")
Set rsMyRS = dbMyDB.OpenRecordSet("MyTable", dbOpenDynaset) ...and then do some operation, like FindFirst, Filter, MoveNext, etc. Think of a recordset like a row of shelves that you can walk around.
(I'd also stop using VB6 and use .Net

)
I can't stop using it - it's for Uni!
Also, I've done one that way (as you have shown above), but I also have to do one the other way which is what I'm looking for. The other way as in using a data object to open the database and table.
It needs to be something like Code:
dataObj.RecordSet.Open the first record that matches SQL
Thanks
-
-
17th April 2009, 09:42 AM #6 Just for further info I already have:
Code:
Set rs = db.OpenRecordset("SELECT * FROM tbl_books,tbl_join WHERE tbl_join.membership_number = '" & txtCustomer(0).Text & "' AND tbl_join.isbn = tbl_books.isbn", dbOpenDynaset)
rs.MoveFirst But I also need to be able to demostrate the other way described above.
-
-
17th April 2009, 03:13 PM #7 
Originally Posted by
Hightower
I can't stop using it - it's for Uni!
Off topic but what Uni are you going to and what course is this for? I find it extremely difficult to figure out the relivance of teaching VB6 at a Uni in 2009 in any other course other than the history of computing.
Last edited by SYNACK; 17th April 2009 at 03:18 PM.
-
-
18th April 2009, 09:24 AM #8 
Originally Posted by
SYNACK
Off topic but what Uni are you going to and what course is this for? I find it extremely difficult to figure out the relivance of teaching VB6 at a Uni in 2009 in any other course other than the history of computing.
It's a HNC/HND/Degree 5 year part time course. I know VB6 is dated and shouldn't be used, but the relevance is (according to lecturer) "being taught how to do things the right way".
Apparantly the skills we learn in this topic can then be transferred to any visual programming style such as VB.net
I'm happy with it - really enjoying it, and I don't doubt his teaching methods.
-
-
18th April 2009, 02:30 PM #9 
Originally Posted by
Hightower
VB6 <snip> is (according to lecturer) "being taught how to do things the right way".
o_O
It's true that learning VB6 will give you skills to transfer, but only really within other Basic languages. It's a very poor language gramatically, and it teaches nothing about typing, memory management, objects, etc, etc.... but then, if you're just starting out it's quite a satisfying language provided you go on to learn those skills later, which I hope you will do.
Last edited by powdarrmonkey; 18th April 2009 at 02:33 PM.
-
SHARE: 
Similar Threads
-
By iking in forum How do you do....it?
Replies: 1
Last Post: 15th July 2009, 10:37 AM
-
By Hightower in forum Coding
Replies: 7
Last Post: 27th April 2009, 10:54 AM
-
By iking in forum Network and Classroom Management
Replies: 2
Last Post: 26th October 2008, 05:39 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules