|
There is a table called QCR100 containing the following information
ITEM_CODE ITEM_DESCRIPTION DCODE AMOUNT
111200 investments 24000003 1630000000.0000
111200 investments 126000005 1630000000.0000
111600 Other Assets 133000009 1700000000.0000
111600 Other Assets 150000002 1730000000.0000
111701 Leasehold 190010130 1740000000.0000
111705 Furniture 190010036 1750000000.0000
111706 Computer Software 190010141 46995799.1800
Then I created a view with this command statement:
SELECT CASE WHEN LEFT(e.dcode, 1) = '1' THEN isnull(SUM(a.Dr_bal_lcy - a.CR_BAL_LCY), 0) WHEN LEFT(e.dcode, 1)
= '2' THEN isnull(SUM(a.CR_BAL_LCY - a.Dr_bal_lcy), 0) ELSE 0 END AS amount, e.ITEM_DESCRIPTION, e.ITEM_CODE
FROM dbo.GLTEMP_CONS AS a RIGHT OUTER JOIN
dbo.QCR100 AS e ON LTRIM(a.GL_code) = e.Dcode
GROUP BY e.ITEM_DESCRIPTION, e.ITEM_CODE, e.Dcode
How I can modify this view to sum the amount for any duplicated item code and group by item code
Example
ITEM_CODE ITEM_DESCRIPTION DCODE AMOUNT
111200 investments 24000003 1630000000.0000
111600 Other Assets 133000009 1700000000.0000
111701 Leasehold 190010130 1740000000.0000
111705 Furniture 190010036 1750000000.0000
111706 Computer Software 190010141 46995799.1800
|
|
|
|
|
This is really a SQL question, not a VB question and should probably belong in the General Database forum.
That said, I'm having a difficult time trying to figure out what you're asking. Is it that your view is doing one level of aggregation, and you need a second (grouping then by item code)? If so, you can use the query you have as a subquery, nested inside another that performs that second level of aggregation:
SELECT ITEM_CODE, SUM(...)
FROM
(
-- original query
SELECT CASE WHEN LEFT(e.dcode,1) = '1' THEN ...
...
) x
GROUP BY ITEM_CODE
|
|
|
|
|
hi,
I have a datagridview control to view the data from the database. The users want to use the keyboard to select a specific row/record by pressing the 'ENTER' key.
its nothing return anything..
Plz help me...
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Make sure that you got something in your database tables and secondly your query is bring something to show. Best thing would be to first try your query on Management Studio and then port it to VB code.
|
|
|
|
|
hi,
i got result...
easy way to select entire rows..
Go to Datagrid proerties one option is there.
ie. selection mode => select Full row select
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
I am designing an Urdu editor. Urdu language is written from right to left. I have implemented this by using rtb.SelectionAlignment = HorizontalAlignment.Right and using SendKeys.Send("{LEFT}") after every key user presses. I have not used the RightToLeft property of rtb because in that case the cursor remains at right side of rtb and as user presses keys the words move to left. Now I implemented justification using some code from net. I tried it on english editor, it works fine. But when I use it for my Urdu editor the cursor goes to left side of rtb and when I type smthg, words move to right side but cursor remains at left side. The code is here
Enum TextAlign
Left = 1
Right = 2
Center = 3
Justify = 4
End Enum
<DllImport("user32", CharSet:=CharSet.Auto)> _
Private Shared Function SendMessage(ByVal hWnd As HandleRef, _
ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function
<DllImport("user32", CharSet:=CharSet.Auto)> _
Private Shared Function SendMessage(ByVal hWnd As HandleRef, _
ByVal msg As Integer, ByVal wParam As Integer, ByRef lp As PARAFORMAT) As Integer
End Function
<StructLayout(LayoutKind.Sequential)> _
Private Structure PARAFORMAT
Public cbSize As Integer
Public dwMask As UInteger
Public wNumbering As Short
Public wReserved As Short
Public dxStartIndent As Integer
Public dxRightIndent As Integer
Public dxOffset As Integer
Public wAlignment As Short
Public cTabCount As Short
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> _
Public rgxTabs() As Integer
' PARAFORMAT2 from here onwards.
Public dySpaceBefore As Int32
Public dySpaceAfter As Int32
Public dyLineSpacing As Int32
Public sStyle As Short
Public bLineSpacingRule As Byte
Public bOutlineLevel As Byte
Public wShadingWeight As Short
Public wShadingStyle As Short
Public wNumberingStart As Short
Public wNumberingStyle As Short
Public wNumberingTab As Short
Public wBorderSpace As Short
Public wBorderWidth As Short
Public wBorders As Short
End Structure
Private updating As Int32 = 0
Private oldEventMask As Int32 = 0
'Constants from the Platform SDK.
Private Const EM_SETEVENTMASK As Integer = 1073
Private Const EM_GETPARAFORMAT As Integer = 1085
Private Const EM_SETPARAFORMAT As Integer = 1095
Private Const EM_SETTYPOGRAPHYOPTIONS As Integer = 1226
Private Const WM_SETREDRAW As Integer = 11
Private Const TO_ADVANCEDTYPOGRAPHY As Integer = 1
Private Const PFM_ALIGNMENT As Integer = 8
Private Const SCF_SELECTION As Integer = 1
Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
MyBase.OnHandleCreated(e)
'Enable support for justification.
SendMessage(New HandleRef(Me, Handle), _
EM_SETTYPOGRAPHYOPTIONS, _
TO_ADVANCEDTYPOGRAPHY, _
TO_ADVANCEDTYPOGRAPHY)
End Sub
Public Overloads Property SelectionAlignment() As TextAlign
Get
Dim fmt As PARAFORMAT = New PARAFORMAT()
fmt.cbSize = Marshal.SizeOf(fmt)
' Get the alignment.
SendMessage(New HandleRef(Me, Handle), _
EM_GETPARAFORMAT, _
SCF_SELECTION, fmt)
' Default to Left align.
If ((fmt.dwMask & PFM_ALIGNMENT) = 0) Then
Return TextAlign.Left
End If
If fmt.wAlignment = 1 Then
Return TextAlign.Left
ElseIf fmt.wAlignment = 2 Then
Return TextAlign.Right
ElseIf fmt.wAlignment = 3 Then
Return TextAlign.Center
ElseIf fmt.wAlignment Then
Return TextAlign.Justify
End If
End Get
Set(ByVal value As TextAlign)
Dim fmt As PARAFORMAT = New PARAFORMAT()
fmt.cbSize = Marshal.SizeOf(fmt)
fmt.dwMask = PFM_ALIGNMENT
fmt.wAlignment = CShort(value)
' Set the alignment.
SendMessage(New HandleRef(Me, Handle), _
EM_SETPARAFORMAT, _
SCF_SELECTION, fmt)
End Set
End Property
I tried with this change
If ((fmt.dwMask & PFM_ALIGNMENT) = 0) Then
Return TextAlign.Right
End If
But it doesn’t work. Can anyone plz tell me how to make it work for urdu language?
|
|
|
|
|
|
I checked it out but I need to change the code. In this code when I justify text, the text is justified from left to right. I want to change this code so that after justifying text retains its right alignment.
|
|
|
|
|
I've been landed with an existing spreadsheet that has a data connection that is used to import some data when it opens. Then they run a macro to organize the data and a few other bits. All is working well.
Now I need to write a macro to save a copy of this workbook, but without the data connection and the macros.
Any pointers welcome!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
So you just want to save the worksheet(s) data without any of the macros? Is that correct? And you want to do this with another macro or do you want to do this through .Net?
|
|
|
|
|
Yeah - and with the data connection removed.
Need to do it using VBA ideally.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Assuming the data and the macros are in different worksheets you should be able to use worksheet saveas in a macro. Look into the options on saveas. I have not written VBA for 15+ years so I may be wrong but I used to record a macro and examining the content to see what MS did.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I'll have to have a look on Monday to see where the macros are actually located.
Mycroft Holmes wrote: I have not written VBA for 15+ years
About 10 for me, and I don't plan on needing it again - what a PITA!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I search some works or stuff for fiscal printer or fiscal devise
|
|
|
|
|
It isn't clear what you are asking, try to rephrase your question.
|
|
|
|
|
|
Hi
I am using the EditingControlShowing event and casting eventargs to a combobox object to get the combobox selectedindex. This works fine when i first select the combobox but before the dropdown.
How do i then trap combobox selectionchanged events?
|
|
|
|
|
Hi all
Though its great to have new features with every release, it sucks if Microsoft takes away old stuff that worked actually great.
I have a searchtextbox with a search button.
And what I want to build in is if someone enter something in the textbox and press enter it should hit the underlying code.
For this I need to use the textbox Keypress Event.
If you look at the code below, I get an error:
Event 'KeyPress' cannot be found
I have to use VB, its the company's policy.No Javascript
Private Sub SearchTxt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles SearchTxt.KeyPress
If Asc(e.KeyChar) = Windows.Forms.Keys.Enter Then
GoButton.PerformClick()
End If
End Sub
Thank you for your time
|
|
|
|
|
Can't test it in 2008 at the moment but you can just use the 'keydown' event.
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
gobutton.performclick()
End If
End Sub
|
|
|
|
|
Perhaps you should try to reinstall visual studio, because the KeyPress event has not been removed from vb.net / vs 2008 (I use it in several apps myself).
Or is your "searchtextbox" not a regular textbox?
My advice is free, and you may get what you paid for.
|
|
|
|
|
Member 4420534 wrote: I have to use VB, its the company's policy.No Javascript
This is either an idiotic statement, or you're writing a website, in which case you should have asked in the ASP.NET forum, and in which case, it's always been the case that you can't handle a keypress event, or a keydown, or anything like that. It would, of course, be utterly retarded for a page to do postbacks every time you press a key.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I am displaying the structure members in a listbox. But i need to remove the commented structure members and then display the the other members in the listbox. how do i do that?
|
|
|
|
|
What on earth do you mean by commented structure members ? You can change the displaymember in the listbox any time you like.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hey Christian,
i am getting this structure member from a C++ file.
for Ex
Struct{
char name[20];
int l_age;
double l_salary;
} Employee;
In this i need to remove int salary and display the rest of the item in the listbox. now i am using InStr to check for "l_" character to select the structure, but how do i avoid the commented members?
modified on Friday, July 24, 2009 2:13 AM
|
|
|
|
|
You can't remove anything from a struct. You can create a new struct that contains only the members you want, and can initialise itself from an instance of a C++ struct, but I fail to understand why you'd bother.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|