dnb 34
New Member
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 2940
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.
QVeen72 1,445
Recognized Expert Top Contributor
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 QVeen72 1,445
Recognized Expert Top Contributor
Hi,
For Access Database, Directly Change the SQL Statement:
"Select Field1,Format(A mtField,'##,### .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 the selected row.
Pls help as this is very important for me.
|
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 .
would someone post a good tute or a WELL COMMENTED sample.. i want to
be able to add a context menus , be able to add the dynamically moving
textbox to edit the contents at runtime...
i got this tute .... .
|
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 choose a particular cell or row in MSHFlexgrid by clicking it? could you help me, please?
Thank you very much!
ADRIAN
|
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 another excel table in that MSHFlexgrid. The problem is, how to add those columns in my MSHFlexgrid?
Or, is there any other way to open an excel table in MSHFlexgrid so I can add columns from another table easier?
Thank you very much for your help!
...
|
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 to add a new data in that MSHFlexgrid. Example: I have 3 rows of data in the MSHFlexgrid, I deleted them all. The deleted datas were gone just fine, but when I entered a new one, MSHFlexgrid shows it in row 4 instead of row 1 (row 1 to 3 are blank)....
| |
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 my textbox by double-clicking the data in MSHF.
I know these script:
Private Sub DGrid DblClick()
With DGrid
Text1.Text = .Columns(0).Text
|
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 and its working. But my problem is about data reports , i dont know how to create data reports base on my query or based on the data that is display on mshflexgrid.
PLEASE HELP!!!thanks :)
|
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,
and i want to save the data from mshflexgrid to another table called B..
is it possible?
thanks in advance....
|
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.
I already used formatnumber & formatcurrency format in query but it does not work.
So Please help me in this matter...
Thank You So Much In Advance.....
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |