Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2004
    Posts
    64

    Unanswered: help with an ADODC data control

    I have placed an ADODC data control on a form (named Adodc1)and I want to link it to either an Access2000 mdb or Access97 mdb whichever one works. I have tried both . I have used the following connection string: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\test\My Documents\Ac2Vb\Order Entry1.mdb;Persist Security Info=False. Tested the connection and Vb says 'Test connection succeeded'.
    Now I have placed a simple textbox on the form and set its data source to the ADODC data control (Adodc1). When I try to click in the data propertys field of the text box I get the message '[ADODC]:no record source specified.[ADO] command text was not set for the command object. I am confused cos I have set the data source to (Adodc1).

    Can any one help

    Franki

  2. #2
    Join Date
    Nov 2004
    Posts
    108
    don't double post http://www.dbforums.com/t1072194.html

    try data form wizard
    to err is human ; to really mess things up requires a computer

  3. #3
    Join Date
    Dec 2004
    Location
    Laguna, Philippines
    Posts
    147
    You didn't specify a recordsource. After you've created a connectionstring, you must also set what recordsource will you connect.
    Give me a place to code and i shall move the earth!

  4. #4
    Join Date
    Sep 2004
    Posts
    112
    Yes I have specified the record source aswell. I have done everything correctly.
    Could it be that a componant is not regestered correctly?. Even the data form wizard does not work !

  5. #5
    Join Date
    Dec 2004
    Location
    Laguna, Philippines
    Posts
    147
    Your connectionstring connects successfully so theres nothing wrong with the component.

    Try connecting to your DB thru hardcode. Besides it is a better practice than using adodc control.
    Give me a place to code and i shall move the earth!

  6. #6
    Join Date
    Sep 2004
    Posts
    112
    I have never used hard code, what is it and could you give me an example of some code to connect to an access 2000 db and also where to put the code.

    Still dont know why the adodc control wont work??????

    Thanks

    Saltman

  7. #7
    Join Date
    Dec 2004
    Location
    Laguna, Philippines
    Posts
    147
    If you still want to use adodc try reinstalling vb and msaccess. Just make sure that all required components including your os is properly installed. But just like i've told you, using hardcode is much better practice.

    Here is a sample code...

    Private Sub Form_Load()
    Dim Con As New ADODB.Connection
    Dim Rs As New ADODB.Recordset

    'Open connection string...
    Con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\SampleDB.mdb;Persist Security Info=False;"
    'Open recordsource...
    Rs.Open "SELECT * FROM [SampleTable];", Con, adOpenDynamic, adLockPessimistic

    Set Text1.DataSource = Rs 'Bind textbox to recordsource...
    Text1.DataField = SampleField 'Bind to field...
    End Sub
    Give me a place to code and i shall move the earth!

  8. #8
    Join Date
    Nov 2004
    Posts
    64
    Thanks for that, I have copied your code and changed the database name/location etc to my data and when I try to run the form I get an error message: Compile Error User defined type not defined. and it highlights the code: Dim Con As New ADODB.Connection

    Any ideas??

    I appreciate you time and thoughts.

    Thanks.

  9. #9
    Join Date
    Nov 2004
    Posts
    64
    Sorry my fault, I did not have correct location of my database in the connection string. The form is now opening but it does not show any data in the test box??.

  10. #10
    Join Date
    Dec 2004
    Location
    Laguna, Philippines
    Posts
    147
    Are you sure your code is right or your database already contains records?

    Remember that strings must be enclosed w/ double quotes "".

    Text1.DataField = "SampleField" 'Bind to field w/ double quotes..

    or...

    myVar = "SampleField"
    Text1.DatafField = myVar 'Bind to field w/o double quotes.
    Give me a place to code and i shall move the earth!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •