|
-
May 25th, 2001, 09:59 AM
#1
Thread Starter
New Member
An easy question about Access
Hi,
Alright, I'm very new to VB and to Access. I am making a grading program for one of my teachers. I am using VB5.0. I have a single form with 127 text boxes for data entry. I have two combo boxes that hold the student names and the class names. I set up a relational database in Access 2000. This is where I think my problem is. Access 2000 won't run in VB5.0. So, I converted and saved Access 2000 to Access 97 so that it would run in VB5.0. By the way, I'm still running in design time stage. I am connecting my program by three data controls connected to my different tables in Access. Each text box is connected to Data3. My Combo1 is connected to Data2 which holds the student names. Combo2 is connected to Data1 which holds my classes. So far so good I think. When I go to save Data to a database this error comes up. Run time error "524" "No Current Record". Here is my save code.
Data1.UpdateRecord
Data2.UpdateRecord
Data3.UpdateRecord
If there is a problem with this please tell me. And please explain in very simple language. I'm still a beginner. Thanks for any help you can give me.
-
May 25th, 2001, 02:20 PM
#2
Lively Member
OK, I don't use data controls but I can tell you how to connect through ADO.
Sub OpenDB()
Set DB = New ADODB.Connection
DB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= [put database location and name here]"
DB.Open
End Sub
Now once you've made your connection you can select from anything at anytime.
You just dim a recordset...
Dim RS as New Adodb.Recordset
and dim a string just to make it easier...
Dim sSQL as string
and create your statement...
sSQL = "Select * from Table1"
RS.Open sSQL, DB, adOpenStatic, adLockReadOnly
Populate your text boxes or combo boxes...
Text1.text = RS("FieldName")
I know this isn't what you're looking for, but maybe it'll help.
-
May 25th, 2001, 02:46 PM
#3
Well, you may want to just use a recordset and join all the tables together in one query, it would be more reliable anyhow. If you want an example of how to do this, send me an e-mail.
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
|
Click Here to Expand Forum to Full Width
|