Stephen Bond
stephen at bondsoftware.co.nz
Tue Feb 21 23:47:12 CST 2012
Thanks Jim, I've decided to bite the bullet and redo. It's just one small sub-subform that's involved. Vanilla always was the best flavour. Stephen Bond -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Tuesday, 21 February 2012 4:16 p.m. To: Stephen Subject: Re: [AccessD] DataGrid control (cont.) Hi Steve: Does DataGrid control even work at all in the newer Access? Does it have to be "added-in"? Is the Active-X control still working in the new computer? Have you tested both DataGrid controls and the ADO.Recordsets separately? If adding in the DGC, in the modules, doesn't work try unregistering and reregistering the DGC at the command prompt. It may not solve your problem but at least you can isolate the issue. HTH Jim -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stephen Bond Sent: Sunday, February 19, 2012 10:33 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] DataGrid control (cont.) 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 -- 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