Re: Reading Access DB: get someteimes Data - sometimes not

From: Val Mazur (group51a_at_hotmail.com)
Date: 07/28/04


Date: Wed, 28 Jul 2004 00:09:31 -0400

Hi,

I do not see anything wrong in a code, except it could be simpler. If it
works on all PCs, except one, then it could be related to the MDAC
corruption. Do you get any error message?
Your code actually should look like (you do not need to check for BOF and
EOF in your case and do not need to use MoveNext)

 Set rst = cmd.Execute()

   If Not rst is Nothing Then
      Do While Not rst.EOF
         '************************* in the beginning, data is retrieved
         Call rst.MoveNext
      Loop
   End If

-- 
Val Mazur
Microsoft MVP
"Marcel Gätzi" <MarcelGtzi@discussions.microsoft.com> wrote in message 
news:408B8031-060B-4121-B955-0BD7B445F6F8@microsoft.com...
> Hi,
>
> I have a very funny situation with reading the same Access db with the 
> same sql statement. Normaly I get data, then not anymore.
>
> I have this situation only at one customer  - the others work fine. 
> According to the customer - after this occures the server crashes. Has 
> anyone a clue what's goin on here? Here's the code I use:
>
>   cnn.Provider = "Microsoft.Jet.OLEDB.4.0;"
>   lsConnect = "Data Source=" + fuSetFilename(lsDBPath, "db.mdb")
>   cnn.Open lsConnect
>   cnn.CommandTimeout = 6000
>   Set cmd.ActiveConnection = cnn
>
>   ls_SQL = "Select Key1 From TableXl Where ID = 1 Order By Key1;"
>
>   cmd.CommandText = ls_SQL
>   Set rst = cmd.Execute()
>
>   If rst.BOF And rst.EOF Then
>      '**************************   sometimes True
>   Else
>      Call rst.MoveFirst
>      Do While Not rst.EOF
>         '*************************   in the beginning, data is retrieved
>         Call rst.MoveNext
>      Loop
>   End If
>
>   rst.Close
>
> further information:
> VB 6.0
> Runs on Windows Server 2000
> Database is on a local Directory!
> 


Relevant Pages

  • Reading Access DB: get someteimes Data - sometimes not
    ... I have a very funny situation with reading the same Access db with the same sql statement. ... I have this situation only at one customer - the others work fine. ... According to the customer - after this occures the server crashes. ... Set rst = cmd.Execute ...
    (microsoft.public.data.ado)
  • RE: Button to FIND and Move to a Specific Record
    ... the combo is an unbound control. ... If you are wanting to look up customers, ... Set rst = Me.RecordsetClone ... You select a customer and it uses the value in CustID to ...
    (microsoft.public.access.formscoding)
  • Re: rst.movenext
    ... What error are you receiving now? ... customer already exists when entering a new contact or customer. ... You get that "too complex" error message on the rst.MoveNext line? ... Set rst = CurrentDb.OpenRecordset("SELECT LastName, ...
    (microsoft.public.access.modulesdaovba)
  • RE: order by customer: sorting
    ... Klatuu I'm very interested in what u ... I would suggest you consider using a Combo Box control rather than ... customer by typing in the name. ... Set rst = Me.RecordsetClone ...
    (microsoft.public.access.forms)
  • RE: Button to FIND and Move to a Specific Record
    ... If you are wanting to look up customers, ... Here is the code for the After Update event you will use ... Set rst = Me.RecordsetClone ... You select a customer and it uses the value in CustID to ...
    (microsoft.public.access.formscoding)