How to give format of data - " which are picked up from Access database through query" - in mshflexgrid in vb 6.0? I want to give currency format to the data. I used Format function in query but it does not work. So please give any idea for this. Thanks in advance.
6 2936
that can be done directly by using sql statment
try like this
select id,name, '$.' ||salary as sal from employee
Yes, but shouldn't Format function also work in SQL?
Yes, but shouldn't Format function also work in SQL?
Yes ,but you need to format the string before passing to SQL and processing or first fetch from sql and then format as per your requirment.
Hi,
How you are populating the MSHFlexGrid..? Setting DataSource or Open Recordset and Loop Through and add row by row..?
If using second method then, you can populate the textmatrix with the formatted String : -
Grd.TextMatrix(i, 2) = Format(RS("MyAmt"), "$#.##")
-
If using First method, then
After Binding to the datasource, Just loop through all the Rows and Format: -
Dim i As Long
-
For i = 1 To Grd.Rows-1
-
Grd.TextMatrix(i, 2) = Format(Val(Grd.TextMatrix(i ,2)) ,"$#.##")
-
Next
-
Regards
Veena
Yes ,but you need to format the string before passing to SQL and processing or first fetch from sql and then format as per your requirment.
No, I mean can't you include Format() function in SQL? I thought Access SQL at least, had a Format function for just this kind of situation.
Ok, I've just checked. Here's some SQL which I built in the Access Query Designer. It works, displaying the numeric field aaa as six digits. SELECT Format([aaa],"000000") AS Um FROM Table1; I entered the values 1, 2, 3 and 28000 in field aaa, then ran this query. Here's the output... Um
000001
000002
000003
028000
Hi,
For Access Database, Directly Change the SQL Statement:
"Select Field1,Format(AmtField,'##,###.00') As MyAmtField From MyTable"
Regards
Veena
Sign in to post your reply or Sign up for a free account.
Similar topics
by: doller |
last post by:
Hi Dear ,
I have a mshflexgrid control on the VB form having 200 rows .I need to
add a row before or after the selected row in the grid.
As wee do in excel
we can add rows before or after...
|
by: giddy |
last post by:
hie,
does anyone know. how to use the MSHFlexGrid.. .in C#... and does'nt
VS 2005 shipp with a NEW MSHflexGrid??? i hav VB6 installed to so does
that create some conflict?? theres only ver. 6.0...
|
by: nairda |
last post by:
Hi,
I'm Adrian from Indonesia.
I have a problem using MSHFlexgrid in VB. I want to show a data from a single cell in MSHFlexgrid that I choose by mouse click in a textbox. The problem is, how to...
|
by: nairda |
last post by:
Hello all!
I have a problem combining 2 tables from excel to my MSHFlexgrid. I've succeeded to show an excel table in my MSHFlexgrid using clipboard, but then I have to add a view columns from...
|
by: nairda |
last post by:
Hi,
I have a minor trouble in my program. I've one MSHFlexgrid to show all datas from an input form that I made. The problem occurs when I deleted one or more rows in the MSHFlexgrid and would like...
|
by: nairda |
last post by:
Hi all,
I have a MSHFlexgrid to show my database and some textboxes to show datas I choosed from MSHFlexgrid.
I would like to know if there's a way to show a specific data I choosed from MSHF in...
|
by: babbles |
last post by:
I have a problem about data reports. My project is to view reports monthly, yearly and daily and show the query on MShflexgrid and show the total income summary.
I have already made my query on that...
|
by: WhiteShore |
last post by:
hi there
just wonder is it possible to save all the data item from mshflexgrid that has been retrieved from another table?
let say i got 1 table called A and has been retrieved by mshflexgrid,...
|
by: dnb |
last post by:
Hi...
Thanx for reply....
I don't want concat string...
But I want to disply "15,000.00" instead of "15000" in MSHflexgrid.
At this time in my MSHflexgrid "15000" format is displayed.
...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |