Results 1 to 3 of 3

Thread: An easy question about Access

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2001
    Posts
    6

    Question 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.
    Joel

  2. #2
    Lively Member
    Join Date
    Feb 2001
    Location
    Fort Lauderdale, FL
    Posts
    98
    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.

  3. #3
    rickm
    Guest
    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
  •  



Click Here to Expand Forum to Full Width