DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: databases

  1. #1
    Jason Guest

    databases


    I am in dire need of help!!!! I need to know how to read information from
    a database using a variable as a field name. I assign a value to a variable
    called 'event_number' and try to use the following line of code to read info.
    from that field in a database.

    If datEvents.Recordset.Fields(event_number).Value <> "" Then ...

    I have a database with 126 fields that each contain a list of numbers in
    some fields. I am trying to read these numbers back into my program. This
    is essential so that i can finish my high school major project. If you have
    any information that could help me i would be eternally grateful.

    Regards, Jason

  2. #2
    Paul Clement Guest

    Re: databases

    On 6 Jun 2002 19:22:47 -0800, "Jason" <year12sdd@huntercs.org> wrote:


    I am in dire need of help!!!! I need to know how to read information from
    a database using a variable as a field name. I assign a value to a variable
    called 'event_number' and try to use the following line of code to read info.
    from that field in a database.

    If datEvents.Recordset.Fields(event_number).Value <> "" Then ...

    I have a database with 126 fields that each contain a list of numbers in
    some fields. I am trying to read these numbers back into my program. This
    is essential so that i can finish my high school major project. If you have
    any information that could help me i would be eternally grateful.

    What data type is event_number defined as? If it is defined as numeric (integer or long) then it
    will refer to the ordinal (index) position of a Field in the Fields collection. If it is a string,
    then the reference is to the actual Field name.

    If you don't define the variable event_number, then it is a Variant data type and the underlying
    field type will depend on the values you assign to it.


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  3. #3
    Jim Guest

    Re: databases


    "Jason" <year12sdd@huntercs.org> wrote:
    >
    >I am in dire need of help!!!! I need to know how to read information from
    >a database using a variable as a field name. I assign a value to a variable
    >called 'event_number' and try to use the following line of code to read

    info.
    >from that field in a database.
    >
    > If datEvents.Recordset.Fields(event_number).Value <> "" Then ...
    >
    >I have a database with 126 fields that each contain a list of numbers in
    >some fields. I am trying to read these numbers back into my program. This
    >is essential so that i can finish my high school major project. If you

    have
    >any information that could help me i would be eternally grateful.
    >
    >Regards, Jason


    '*******************************************
    Try this... If datEvents.Recordset.Fields("event_number").Value <> "" Then
    ...

    You left out the quotes..!!!

    Jim


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center