473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to GIve Format to the data in mshflexgrid?

dnb
34
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.
Jan 3 '08 #1
6 2936
debasisdas
8,127 Expert 4TB
that can be done directly by using sql statment

try like this

select id,name, '$.' ||salary as sal from employee
Jan 3 '08 #2
Killer42
8,435 Expert 8TB
Yes, but shouldn't Format function also work in SQL?
Jan 4 '08 #3
debasisdas
8,127 Expert 4TB
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.
Jan 4 '08 #4
QVeen72
1,445 Expert 1GB
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 :
Expand|Select|Wrap|Line Numbers
  1. Grd.TextMatrix(i, 2) = Format(RS("MyAmt"), "$#.##")
  2.  
If using First method, then
After Binding to the datasource, Just loop through all the Rows and Format:
Expand|Select|Wrap|Line Numbers
  1. Dim i As Long
  2. For i = 1 To Grd.Rows-1
  3.   Grd.TextMatrix(i, 2) = Format(Val(Grd.TextMatrix(i ,2)) ,"$#.##")
  4. Next
  5.  
Regards
Veena
Jan 4 '08 #5
Killer42
8,435 Expert 8TB
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
Jan 4 '08 #6
QVeen72
1,445 Expert 1GB
Hi,

For Access Database, Directly Change the SQL Statement:

"Select Field1,Format(AmtField,'##,###.00') As MyAmtField From MyTable"

Regards
Veena
Jan 4 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
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...
4
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...
2
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...
0
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...
4
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...
4
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...
1
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...
2
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,...
3
dnb
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. ...
0
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$) { } ...
0
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...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.