DATAWIDGET: Unbound DataGrid-Problem

DATAWIDGET: Unbound DataGrid-Problem

Post by Frank Spinde » Sun, 29 Mar 1998 04:00:00



If I click in the last record of the grid i get a runtime-error. This
doesn't
happen, if I click in a other record first, or if I set the AllowAddNew
to true.

Can anybody help me???

 
 
 

1. Datagrids, Unbound Forms & ADO

Hi!  In the past, I have used ADO controls and bound forms for database
access, but now have a need to use an unbound form, and fill a datagrid
control with data.

I declare the following for the form "frmCharter":

Dim mcnCharterApp As Connection
Dim mrsCharter As Recordset

Next, at the Form Load event, I use the following code to establish the
link to the database:

    Set mcnCharterApp = New Connection
    Set mrsCharter = New Recordset
    mcnCharterApp.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        " Data Source =" & databasePath & ";"

where databasePath is a variable containing the fully qualified path to
my database. (an Access 2000 database).

Now, I want to get all of my records for the date specified, so I use
the following to load up my recordset:

    strQuery = "SELECT
[CHARTER].[CHARTER_EVENT_NAME],[CHARTER].[CHARTER_DESTINATION],[CHARTER].[CHARTER_ORIGINATION],[CHARTER].[CHARTER_SPECIAL_INSTRUCTIONS_1],[CHARTER].[CHARTER_PICKUP_TIME],[CHARTER].[CHARTER_RETURN_TIME],[CHARTER].[CHARTER_DAY_OF_CHARTER],[CHARTER].[CHARTER_QUOTED_PRICE],[CHARTER].[CHARTER_NUMBER_OF_BUSES],[CHARTER].[CHARTER_HOW_CUSTOMER_PAYS],[CHARTER].[CHARTER_DATE_CONTACT_CALLED],[CHARTER].[CHARTER_WAS_SLIP_MADE],[CHARTER].[CHARTERID],[CHARTER].[CONTACTID],[CONTACT].[CONTACTID],[CONTACT].[CONTACT_LAST_NAME],[CONTACT].[CONTACT_FIRST_NAME],[CONTACT].[CONTACT_PHONE_NUMBER]"
& _
                " FROM [CONTACT] INNER JOIN [CHARTER] ON
[CONTACT].[CONTACTID] = [CHARTER].[CONTACTID]" & _
                " WHERE ([CHARTER].[CHARTER_DATE_OF_CHARTER] = #" & _
               Calendar1.Value & "#" & _
                " AND ([CHARTER].[CHARTER_AM_OR_PM_TRIP] = '" & sAMPM &
"'));"
    mrsCharter.Open strQuery, mcnCharterApp, adOpenKeyset, _
                    adLockOptimistic, adCmdText

Finally, I set the record source for my grid control (grdCharter) as
follows:

    Set grdCharter.DataSource = mrsCharter

My question is as follows:  What do I need to do to populate the
information in the recordset into the datagrid.  In the past, when I
have done this with a bound form (datagrid to the ADO control on the
form), this all happened automatically.  It doesn't seem to be happening
this way now, and I suspect that I need to load the form up through
code.

Any thoughts?

Thanks!

-Mike-

2. SQL Server TimeStamp Retrieval

3. Unbound Datagrid Confusion!

4. need legacy Lotus 123 & Symphony

5. datagrid unbound columns ?

6. Memory problems with SP2

7. datagrid with unbound columns ?

8. Oracle Novell IP vs IPX

9. How to populate an unbound DataGrid?

10. weird RDO bound to datawidgets DBcombo problem

11. Combo box problem(Sheridan datawidgets)

12. Datawidgets 2.0

13. Another question on Datawidgets DBgrid...