Results 1 to 11 of 11

Thread: Vb

  1. #1
    Join Date
    Sep 2003
    Posts
    102

    Unanswered: Vb

    Thx,
    how would u create a recordset based on a table ?


    you would think there'd be someway to access the table directly; like Excel to a spreadsheet cell..

    why they gotta be so difficult ?

  2. #2
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91

    Re: Vb

    Hi VB!

    Here you´re a piece of code where I read all fields of a table, get one of them, "put" its value into a form field:

    Dim rst As ADODB.Recordset
    Set rst = New ADODB.Recordset

    With rst

    .CursorType = adOpenForwardOnly
    .LockType = adLockOptimistic
    .Source = "SELECT * FROM myTableName WHERE " & MyCondition

    .Open , CurrentProject.Connection
    .MoveFirst

    Me.FormField1 = !TableField1
    .Close

    End With


    Set rst = Nothing



    It´s simple, isn´t it ?

  3. #3
    Join Date
    Sep 2003
    Posts
    102

    Re: Vb

    thx a bunch...
    do u know of a VBA reference guide site online ?


    and is there anystuff I can't do in Access VBA that I can in Excel VBA ?

  4. #4
    Join Date
    Sep 2003
    Posts
    102

    Re: Vb

    thx a bunch...
    do u know of a VBA reference guide site online ?


    and is there anystuff I can't do in Access VBA that I can in Excel VBA ?

  5. #5
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91

  6. #6
    Join Date
    Sep 2003
    Posts
    102

    Re: Vb

    Thx for the help
    but i get the error:

    Compile Error:
    Invalid use of Me Keyword


    do you know whats is wrong w/ taht ?
    for the line
    Me.FormField1 = !TableField1

  7. #7
    Join Date
    Sep 2003
    Posts
    102
    Here is curretnly how i get a field value:

    Const conPropertyNotFound = 3270 ' Property not found error.
    Set dbs = CurrentDb ' Define Database object.
    Set cnt = dbs.Containers!Databases ' Define Container object.
    Set doc = cnt.Documents!UserDefined ' Define Document object.

    Set tdf = CurrentDb.QueryDefs!ForRequestTix
    Set fld = tdf.Fields("Problem_Summary")

    MsgBox Cells(2, 2).Value

    Cept the last line is not correct.

    How do i access fld(2,2) ?

    thanks

  8. #8
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91
    Where did Cell(x,y) come from ?

  9. #9
    Join Date
    Sep 2003
    Posts
    102
    Originally posted by Mixirica
    Where did Cell(x,y) come from ?
    That's where I'm stuck at...

    i can get an object to point to that column in taht table...put how do i get the value in that column ?

    the Cell(x,y) would be how i would do it in Excel...but waht do i do in Acccess ?


    thanks again,

  10. #10
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91
    Database world don´t work like this.

    First you have to locate the record (Excell´s line) then you have to get the field value (Excell´s Row).

    Try to read something of Data Normalisation here:

    http://www.school-resources.co.uk/Normalisation.htm

    Good Luck
    My environment: Windows XP/ Access 2000 - Using Microsoft DAO 3.6 Library

  11. #11
    Join Date
    Sep 2003
    Posts
    102
    ok cooll...
    thanks , i read it...
    but i still don't know how to even access the field from the Access table.

    Here's what i need to do:

    I need to get the value's in a certain field from each record in a table. I do not have to put this value into another table.

    What i don't know how to do:

    Get the value and store it into some variable.

Posting Permissions

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