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 Finally, I set the record source for my grid control (grdCharter) as Set grdCharter.DataSource = mrsCharter My question is as follows: What do I need to do to populate the Any thoughts? Thanks! -Mike-
[CHARTER].[CHARTER_EVENT_NAME],[CHARTER].[CHARTER_DESTINATION],[CHARTER].[C
& _
" 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
follows:
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.