binding a MSHFlexgrid 
Author Message
 binding a MSHFlexgrid

I'm trying to bind a MSHFlexgrid to a recordset and I don't know if there`s
something wrong in my code, but the flexgrid don't show the data.
The code goes like this:

    Set Rs = New ADODB.Recordset
    Rs.Open "Select * from Mytable Where Data = " & Date, Con, adOpenStatic,
    adLockOptimistic
    Set flexFabricacio.DataSource = Rs

Any advice ? Thanks.



Mon, 09 May 2005 06:32:02 GMT  
 binding a MSHFlexgrid
Hi, thanks for your answer Ed, but I still got the same problem. The data,
although is already in the table where the SQL statement is taking it from,
do not show in the MSGFlexgrid as I pretend. Now, my code goes like this on
the form_load:

    Set Con = New ADODB.Connection
    Con.CursorLocation = adUseClient
    Con.Open "Provider=Microsoft.Jet.Oledb.4.0;" & _
            "Data Source=D:\database.mdb;"

    Set Rs = New ADODB.Recordset
    Rs.Open "Select * from DadesProduccio", Con, adOpenStatic,
adLockOptimistic

    Set RsFab = New ADODB.Recordset
    RsFab.Open "Select * from FabHistoria", Con, adOpenStatic,
adLockOptimistic

    Set RsDia = New ADODB.Recordset
    RsDia.Open "Select FabHistoria.NoFabricacio," & _
    "FabHistoria.Producte,FabHistoria.LotEconomic," & _
    "FabHistoria.QuantitatdeLots,FabHistoria.MinutsTotals " & _
    "from FabHistoria Where Data = " & Date, Con, adOpenStatic,
adLockOptimistic

    Set flexFabricacio.Recordset = RsDia

Any suggestions for me? Thanks in advance.



Quote:
> Hi,
> Rather than the Data Source property, you want to set the
> Recordset Property like this...

> Set flexFabricacio.Recordset = Rs

> This will work.
> HTH
> Ed Voss
> MCP
> >-----Original Message-----
> >I'm trying to bind a MSHFlexgrid to a recordset and I
> don't know if there`s
> >something wrong in my code, but the flexgrid don't show
> the data.
> >The code goes like this:

> >    Set Rs = New ADODB.Recordset
> >    Rs.Open "Select * from Mytable Where Data = " &
> Date, Con, adOpenStatic,
> >    adLockOptimistic
> >    Set flexFabricacio.DataSource = Rs

> >Any advice ? Thanks.

> >.



Mon, 09 May 2005 21:14:01 GMT  
 binding a MSHFlexgrid
Hi,

Are you sure that recordset has any records in it? Also try to set
CursorLocation of recordset to adUseClient

--
Val Mazur
Microsoft MVP

Quote:

> Hi, thanks for your answer Ed, but I still got the same problem. The data,
> although is already in the table where the SQL statement is taking it
from,
> do not show in the MSGFlexgrid as I pretend. Now, my code goes like this
on
> the form_load:

>     Set Con = New ADODB.Connection
>     Con.CursorLocation = adUseClient
>     Con.Open "Provider=Microsoft.Jet.Oledb.4.0;" & _
>             "Data Source=D:\database.mdb;"

>     Set Rs = New ADODB.Recordset
>     Rs.Open "Select * from DadesProduccio", Con, adOpenStatic,
> adLockOptimistic

>     Set RsFab = New ADODB.Recordset
>     RsFab.Open "Select * from FabHistoria", Con, adOpenStatic,
> adLockOptimistic

>     Set RsDia = New ADODB.Recordset
>     RsDia.Open "Select FabHistoria.NoFabricacio," & _
>     "FabHistoria.Producte,FabHistoria.LotEconomic," & _
>     "FabHistoria.QuantitatdeLots,FabHistoria.MinutsTotals " & _
>     "from FabHistoria Where Data = " & Date, Con, adOpenStatic,
> adLockOptimistic

>     Set flexFabricacio.Recordset = RsDia

> Any suggestions for me? Thanks in advance.



> > Hi,
> > Rather than the Data Source property, you want to set the
> > Recordset Property like this...

> > Set flexFabricacio.Recordset = Rs

> > This will work.
> > HTH
> > Ed Voss
> > MCP
> > >-----Original Message-----
> > >I'm trying to bind a MSHFlexgrid to a recordset and I
> > don't know if there`s
> > >something wrong in my code, but the flexgrid don't show
> > the data.
> > >The code goes like this:

> > >    Set Rs = New ADODB.Recordset
> > >    Rs.Open "Select * from Mytable Where Data = " &
> > Date, Con, adOpenStatic,
> > >    adLockOptimistic
> > >    Set flexFabricacio.DataSource = Rs

> > >Any advice ? Thanks.

> > >.



Mon, 09 May 2005 21:18:53 GMT  
 binding a MSHFlexgrid
Hi,
yeah, I've been looking at it and the recordset got records in it. Also the
recordset's CursorLocation set to adUseClient don't seem to be the reason. I
discover that the reason might be the SQL statement I've used. When using it
like this....
    Set RsDia = New ADODB.Recordset
    RsDia.Open "SELECT * FROM FabHistoria", ConDia, adOpenStatic,
adLockOptimistic,         adCmdText
    Set flexFabricacio.Recordset = RsDia
the thing works fine and the MSHFlexgrid loads the recordset but when
stating that....
    RsDia.Open "SELECT * FROM FabHistoriaWHERE Data = " & Date, ConDia,
adOpenStatic, adLockOptimistic, adCmdText
    Set flexFabricacio.Recordset = RsDia
    gives an error on the from statement.
    I just want the recordset to be filled with the records that have been
added today (function           Date).
    Thanks for your suggestions.



Quote:
> Hi,

> Are you sure that recordset has any records in it? Also try to set
> CursorLocation of recordset to adUseClient

> --
> Val Mazur
> Microsoft MVP




Quote:
> > Hi, thanks for your answer Ed, but I still got the same problem. The
data,
> > although is already in the table where the SQL statement is taking it
> from,
> > do not show in the MSGFlexgrid as I pretend. Now, my code goes like this
> on
> > the form_load:

> >     Set Con = New ADODB.Connection
> >     Con.CursorLocation = adUseClient
> >     Con.Open "Provider=Microsoft.Jet.Oledb.4.0;" & _
> >             "Data Source=D:\database.mdb;"

> >     Set Rs = New ADODB.Recordset
> >     Rs.Open "Select * from DadesProduccio", Con, adOpenStatic,
> > adLockOptimistic

> >     Set RsFab = New ADODB.Recordset
> >     RsFab.Open "Select * from FabHistoria", Con, adOpenStatic,
> > adLockOptimistic

> >     Set RsDia = New ADODB.Recordset
> >     RsDia.Open "Select FabHistoria.NoFabricacio," & _
> >     "FabHistoria.Producte,FabHistoria.LotEconomic," & _
> >     "FabHistoria.QuantitatdeLots,FabHistoria.MinutsTotals " & _
> >     "from FabHistoria Where Data = " & Date, Con, adOpenStatic,
> > adLockOptimistic

> >     Set flexFabricacio.Recordset = RsDia

> > Any suggestions for me? Thanks in advance.



> > > Hi,
> > > Rather than the Data Source property, you want to set the
> > > Recordset Property like this...

> > > Set flexFabricacio.Recordset = Rs

> > > This will work.
> > > HTH
> > > Ed Voss
> > > MCP
> > > >-----Original Message-----
> > > >I'm trying to bind a MSHFlexgrid to a recordset and I
> > > don't know if there`s
> > > >something wrong in my code, but the flexgrid don't show
> > > the data.
> > > >The code goes like this:

> > > >    Set Rs = New ADODB.Recordset
> > > >    Rs.Open "Select * from Mytable Where Data = " &
> > > Date, Con, adOpenStatic,
> > > >    adLockOptimistic
> > > >    Set flexFabricacio.DataSource = Rs

> > > >Any advice ? Thanks.

> > > >.



Tue, 10 May 2005 03:08:50 GMT  
 binding a MSHFlexgrid
Hi,

Is it Access or SQL Server? In case of Access add # to your dates in case of
SQL Server wrap your date into single quotes

For Access
RsDia.Open "SELECT * FROM FabHistoriaWHERE Data = #" & Date & "#", ConDia,

For SQL Server

RsDia.Open "SELECT * FROM FabHistoriaWHERE Data = '" & Date & "'", ConDia,

--
Val Mazur
Microsoft MVP

Quote:

> Hi,
> yeah, I've been looking at it and the recordset got records in it. Also
the
> recordset's CursorLocation set to adUseClient don't seem to be the reason.
I
> discover that the reason might be the SQL statement I've used. When using
it
> like this....
>     Set RsDia = New ADODB.Recordset
>     RsDia.Open "SELECT * FROM FabHistoria", ConDia, adOpenStatic,
> adLockOptimistic,         adCmdText
>     Set flexFabricacio.Recordset = RsDia
> the thing works fine and the MSHFlexgrid loads the recordset but when
> stating that....
>     RsDia.Open "SELECT * FROM FabHistoriaWHERE Data = " & Date, ConDia,
> adOpenStatic, adLockOptimistic, adCmdText
>     Set flexFabricacio.Recordset = RsDia
>     gives an error on the from statement.
>     I just want the recordset to be filled with the records that have been
> added today (function           Date).
>     Thanks for your suggestions.



> > Hi,

> > Are you sure that recordset has any records in it? Also try to set
> > CursorLocation of recordset to adUseClient

> > --
> > Val Mazur
> > Microsoft MVP



> > > Hi, thanks for your answer Ed, but I still got the same problem. The
> data,
> > > although is already in the table where the SQL statement is taking it
> > from,
> > > do not show in the MSGFlexgrid as I pretend. Now, my code goes like
this
> > on
> > > the form_load:

> > >     Set Con = New ADODB.Connection
> > >     Con.CursorLocation = adUseClient
> > >     Con.Open "Provider=Microsoft.Jet.Oledb.4.0;" & _
> > >             "Data Source=D:\database.mdb;"

> > >     Set Rs = New ADODB.Recordset
> > >     Rs.Open "Select * from DadesProduccio", Con, adOpenStatic,
> > > adLockOptimistic

> > >     Set RsFab = New ADODB.Recordset
> > >     RsFab.Open "Select * from FabHistoria", Con, adOpenStatic,
> > > adLockOptimistic

> > >     Set RsDia = New ADODB.Recordset
> > >     RsDia.Open "Select FabHistoria.NoFabricacio," & _
> > >     "FabHistoria.Producte,FabHistoria.LotEconomic," & _
> > >     "FabHistoria.QuantitatdeLots,FabHistoria.MinutsTotals " & _
> > >     "from FabHistoria Where Data = " & Date, Con, adOpenStatic,
> > > adLockOptimistic

> > >     Set flexFabricacio.Recordset = RsDia

> > > Any suggestions for me? Thanks in advance.



> > > > Hi,
> > > > Rather than the Data Source property, you want to set the
> > > > Recordset Property like this...

> > > > Set flexFabricacio.Recordset = Rs

> > > > This will work.
> > > > HTH
> > > > Ed Voss
> > > > MCP
> > > > >-----Original Message-----
> > > > >I'm trying to bind a MSHFlexgrid to a recordset and I
> > > > don't know if there`s
> > > > >something wrong in my code, but the flexgrid don't show
> > > > the data.
> > > > >The code goes like this:

> > > > >    Set Rs = New ADODB.Recordset
> > > > >    Rs.Open "Select * from Mytable Where Data = " &
> > > > Date, Con, adOpenStatic,
> > > > >    adLockOptimistic
> > > > >    Set flexFabricacio.DataSource = Rs

> > > > >Any advice ? Thanks.

> > > > >.



Tue, 10 May 2005 03:21:01 GMT  
 binding a MSHFlexgrid
Great Val, thanks


Quote:
> Hi,

> Is it Access or SQL Server? In case of Access add # to your dates in case
of
> SQL Server wrap your date into single quotes

> For Access
> RsDia.Open "SELECT * FROM FabHistoriaWHERE Data = #" & Date & "#", ConDia,

> For SQL Server

> RsDia.Open "SELECT * FROM FabHistoriaWHERE Data = '" & Date & "'", ConDia,

> --
> Val Mazur
> Microsoft MVP




- Show quoted text -

Quote:
> > Hi,
> > yeah, I've been looking at it and the recordset got records in it. Also
> the
> > recordset's CursorLocation set to adUseClient don't seem to be the
reason.
> I
> > discover that the reason might be the SQL statement I've used. When
using
> it
> > like this....
> >     Set RsDia = New ADODB.Recordset
> >     RsDia.Open "SELECT * FROM FabHistoria", ConDia, adOpenStatic,
> > adLockOptimistic,         adCmdText
> >     Set flexFabricacio.Recordset = RsDia
> > the thing works fine and the MSHFlexgrid loads the recordset but when
> > stating that....
> >     RsDia.Open "SELECT * FROM FabHistoriaWHERE Data = " & Date, ConDia,
> > adOpenStatic, adLockOptimistic, adCmdText
> >     Set flexFabricacio.Recordset = RsDia
> >     gives an error on the from statement.
> >     I just want the recordset to be filled with the records that have
been
> > added today (function           Date).
> >     Thanks for your suggestions.



> > > Hi,

> > > Are you sure that recordset has any records in it? Also try to set
> > > CursorLocation of recordset to adUseClient

> > > --
> > > Val Mazur
> > > Microsoft MVP



> > > > Hi, thanks for your answer Ed, but I still got the same problem. The
> > data,
> > > > although is already in the table where the SQL statement is taking
it
> > > from,
> > > > do not show in the MSGFlexgrid as I pretend. Now, my code goes like
> this
> > > on
> > > > the form_load:

> > > >     Set Con = New ADODB.Connection
> > > >     Con.CursorLocation = adUseClient
> > > >     Con.Open "Provider=Microsoft.Jet.Oledb.4.0;" & _
> > > >             "Data Source=D:\database.mdb;"

> > > >     Set Rs = New ADODB.Recordset
> > > >     Rs.Open "Select * from DadesProduccio", Con, adOpenStatic,
> > > > adLockOptimistic

> > > >     Set RsFab = New ADODB.Recordset
> > > >     RsFab.Open "Select * from FabHistoria", Con, adOpenStatic,
> > > > adLockOptimistic

> > > >     Set RsDia = New ADODB.Recordset
> > > >     RsDia.Open "Select FabHistoria.NoFabricacio," & _
> > > >     "FabHistoria.Producte,FabHistoria.LotEconomic," & _
> > > >     "FabHistoria.QuantitatdeLots,FabHistoria.MinutsTotals " & _
> > > >     "from FabHistoria Where Data = " & Date, Con, adOpenStatic,
> > > > adLockOptimistic

> > > >     Set flexFabricacio.Recordset = RsDia

> > > > Any suggestions for me? Thanks in advance.



> > > > > Hi,
> > > > > Rather than the Data Source property, you want to set the
> > > > > Recordset Property like this...

> > > > > Set flexFabricacio.Recordset = Rs

> > > > > This will work.
> > > > > HTH
> > > > > Ed Voss
> > > > > MCP
> > > > > >-----Original Message-----
> > > > > >I'm trying to bind a MSHFlexgrid to a recordset and I
> > > > > don't know if there`s
> > > > > >something wrong in my code, but the flexgrid don't show
> > > > > the data.
> > > > > >The code goes like this:

> > > > > >    Set Rs = New ADODB.Recordset
> > > > > >    Rs.Open "Select * from Mytable Where Data = " &
> > > > > Date, Con, adOpenStatic,
> > > > > >    adLockOptimistic
> > > > > >    Set flexFabricacio.DataSource = Rs

> > > > > >Any advice ? Thanks.

> > > > > >.



Tue, 10 May 2005 06:08:01 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. VB6: Refresh non-bound MSHFlexGrid preiodically?

2. AddItem, RemoveItem produce error when MSHFlexGrid is bound to hierarchical recordset

3. How to bind data to MSHFlexGrid

4. MSHFlexGrid bound to empty Table

5. ADO Bound MSHFlexGrid gets locked on filter/refresh.

6. Display column headers on data bound MSHFlexGrid when no records

7. MSHFlexGrid - Binding taking too long

8. MSHFlexGrid - Create bands without a bound database

9. Can non-bound MSHFlexGrid be hierarchical?

10. Bound a Shaped recordset to a MSHFlexGrid

11. Selection bug for MSHFlexgrid when bound to an empty Recordset

12. ADO Bound MSHFlexGrid gets locked on filter/refresh.

 

 
Powered by phpBB® Forum Software