[AccessD] DataGrid control (cont.)

Stephen Bond stephen at bondsoftware.co.nz
Mon Feb 20 00:33:04 CST 2012


Good question Stuart.  Like you, I've eschewed the Microsoft 'latest
fad' over the years, usually.  In this case I was experimenting (years
ago) with ADO and DataGrids in A2K, and it just kinda stayed on in the
app.  Bad choice, huh?  I've been trying a few things in the past few
days from various MS sources (mostly contradictory).  Looks like the
quickest solution will be to go back to vanilla. 

Stephen Bond

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart
McLachlan
Sent: Monday, 20 February 2012 1:31 p.m.
To: Stephen
Subject: Re: [AccessD] DataGrid control (cont.)

Can't help with your query.

But out of curiosity,  why are you using a datagrid in preference to a
subform in datasheet 
view?  

-- 
Stuart

On 20 Feb 2012 at 13:03, Stephen Bond wrote:

> Here's the whole Sub if that helps:
> ================================================
> Sub FillGridSpecificJobObservations(ByVal pk)
> Dim strSQL As String
>   Set rs = New ADOdb.Recordset
>   Set rs.ActiveConnection = CurrentProject.Connection
>   rs.CursorType = adOpenStatic
>   rs.LockType = adLockReadOnly
>   rs.CursorLocation = adUseClient
>   strSQL = "SELECT qryEquipmentRegisterRHS.JobId, " & _
>                    "qryEquipmentRegisterRHS.ObservationId AS ObsId, "
&
> _
>                    "qryEquipmentRegisterRHS.ObserverName AS
ObservName,
> " & _
>                    "qryEquipmentRegisterRHS.ObserverDate AS
ObservDate,
> " & _
>                    "qryEquipmentRegisterRHS.ObserverTime AS ObsTime, "
&
> _
>                    "qryEquipmentRegisterRHS.Shift, " & _
>                    "qryEquipmentRegisterRHS.Id"
>   strSQL = strSQL & " FROM qryEquipmentRegisterRHS "
>   strSQL = strSQL & " WHERE qryEquipmentRegisterRHS.JobId = " & pk &
";"
>   rs.Open strSQL
>   rs.Sort = "ObsId Asc"
>   SortAsc = True
>   Set Me.DataGridSpecificJobObservations.DataSource = rs   '  <---
> runtime error on this line
>   
>   Me.DataGridSpecificJobObservations.Refresh
>   
>   Set dg = Me.DataGridSpecificJobObservations
>   dg.Font.Size = 8
>   dg.RecordSelectors = False
>   dg.Columns(0).Width = 0     ' JobId
>   dg.Columns(1).Width = 500   ' ObservationId
>   dg.Columns(2).Width = 1800  ' Name
>   dg.Columns(3).Width = 1000  ' Date
>   dg.Columns(4).Width = 800   ' Time
>   dg.Columns(5).Width = 450   ' Shift (was S or U)
>   dg.Columns(6).Width = 0     ' Id
>  ' dg.Columns(5).NumberFormat = "currency"
>   dg.Columns(3).NumberFormat = "dd/mm/yyyy"
>   dg.Columns(4).NumberFormat = "hh:nn"
>   dg.Columns(3).Alignment = 2
>   dg.Columns(4).Alignment = 2
>   dg.Columns(5).Alignment = 2
>   dg.MarqueeStyle = 3
>   If rs.RecordCount = 0 Then
>  '   Me.Toolbar1.Buttons("Edit").Enabled = False
>   Else
>   '  Me.Toolbar1.Buttons("Edit").Enabled = True
>   End If
> End Sub
> 
> =================================
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list