[dba-VB] Sounds easy.... but I'm a kind of getting stuck here...

Salakhetdinov Shamil mcp2004 at mail.ru
Thu Apr 5 08:44:28 CDT 2012


Hi Gustav --

Yes, you can use built-in VBA functions in MS Access backend saved queries and run that queries from within your .NET apps - MS Jet Engine "is aware" of VBA.

>   Date() - [SavedStartDateValue]
> but I doubt Date() is at your disposal.
It isn't - ADO.NET DataSets calculated columns expressions are very limited.

Thank you.

-- Shamil


Thu, 05 Apr 2012 15:20:48 +0200 от "Gustav Brock" <gustav at cactus.dk>:
> Hi Shamil
> 
> OK, seems like you are limited to basic expressions as in the report viewer.
> 
> So your expression could look like:
> 
>   Date() - [SavedStartDateValue]
> 
> but I doubt Date() is at your disposal.
> Anyway, you should be able to sort on [SavedStartDateValue] and not the days' count.
> 
> Don't know if a saved query will do ... does it support functions Of VBA like Date()?
> 
> /gustav
> 
> 
> >>> Salakhetdinov Shamil <mcp2004 at mail.ru> 05-04-12 14:17 >>>
> Hi Gustav --
> 
> Setting cell value in.RowPostPaint works well, but DataGridView is flickering a bit...
> 
> > Not possible to create?
> I meant I can't create a calculated column with a formula as e.g.
> 
>  ([SavedStartDateValue] - DataTime.Today).TotalDays
> 
> Never used that "complex" calculated columns before.
> The set of possible calculated columns expressions seems to be very limited - http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx
> 
> I have also tried to use unbound column and to set its value in .RowPostPaint event - that worked well, DataGridView flickering disappeared but in this case automatic sorting of DataGridView by unbound column isn't working.
> Implementation of manual (custom code driven) sorting seems to be not right way to go as it would be laborious and it would relatively slow comparing to bound columns sorting: the source dataset has more than 10000 rows and the quantity of rows will grow with time - that is a customer requirement...
> 
> So I decided to give-up and to get column values calculated in a back-end MS Access database query...
> 
> Do you expect there could be an effective solution for my case without using calculated columns created in MS Access back-end queries?
> 
> Thank you.
> 
> -- Shamil
> 
> 
> 
> Thu, 05 Apr 2012 13:24:27 +0200 от "Gustav Brock" <gustav at cactus.dk>:
> > Hi Shamil
> > 
> > Not possible to create?
> > 
> > Are you receiving an error or getting blank results before the RowPostPaint?
> > 
> > /gustav
> > 
> > 
> > >>> Salakhetdinov Shamil <mcp2004 at mail.ru> 05-04-12 11:53 >>>
> > Hi All --
> > 
> > I have a DataGridView bound to a DataSet created on MS Access back-end table using built-in into DataSet SQL query.
> > And I need a calculated column to have a value equal to a
> > 
> > ([SavedStartDateValue] - DataTime.Today).TotalDays
> > 
> > That seems to be not possible to create?
> > 
> > I tried to use .PostPaint event to have a value calculated on run-time. It works but DataGridView "flickers".
> > 
> > Because of design limitations I can't create a custom query in MS Access back-end db with a calculated field value to be used as binding source for target  DataGridView column.
> > 
> > I'd be very grateful for any useful for my real programming case advises.
> > 
> > TIA,
> > -- Shamil
> 
> 
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 
> 



More information about the dba-VB mailing list