|
Hi Richard,
Thanks, I have read this article, but it only covers data access, whereas I specifically need the reports / printing functionality.
The basic idea is that my access database is linked to an MS SQL database, and takes its data from there. Data access simply goes through MS SQL client.
Regards,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Johan Hakkesteegt wrote: I specifically need the reports / printing functionality.
So what's wrong with the second example, "Print or Preview an Access Report"?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
Sorry, I mixed up the articles, because it mentions "...vs ADO...", and there is another article about using ADO to connect to an Access database. Anyway, my original code was written according to this article, and indeed worked fine.
The problem is, that the code in this article no longer works once you install Office 2016 (at least the version that comes with Office365, if there is a difference), as apparently it does not include the Access Object Library.
Regards,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi Richard,
It all turned out to be an installation issue with Office. After an online repair of my Office 2016 installation, the references were back, and my code ran just fine again.
Thanks for your help though.
Regards,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Johan Hakkesteegt wrote:
It all turned out to be an installation issue with Office.
and this is why most of us do not use office. Office and access are great tool but should be used for individual productivity not a developed application. MS has a track record of breaking office.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
No argument here. I just use Access because it happens to be in Office anyway, and I have neither budget to purchase any better tools, nor the time to build my own.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hai Johan,
Me too faced the same problem recently, with excel 2013 and I fixed that by installing Office 2013 PIA (Primary Interop Assemblies). So here I strongly suggest you to install office 2016 PIA, which you can directly download from Microsoft official site. To know more about Microsoft Office PIA please refer:
Office Primary Interop Assemblies[^]
Thanks and regards
Ashwin 😃
|
|
|
|
|
After some more digging I finally happened upon an article that showed me what to do
by implementing ICustomTypeDescriptor.
This question is closed.
Hello, I am creating several controls which inherit from vb common controls and want to
implement custom properties to my controls.
Example pseudo code:
Class A
Inherits Button
public Property MyProperty() as String
....
End Property
end class
Class B
Inherits ComboBox
public Property MyProperty() as String
....
End Property
end class
I have several properties that provide the same implementation for each class.
Rather than copying code for each class, is there a way to define MyProperty() in
a common module and then include the module in Class A and B?
Also, the example does not show it but the properties are presented to PropertyGrid.
Thank you
-- modified 9-Jan-18 16:02pm.
|
|
|
|
|
Hi
i try to make a total of earning every days . so i try to filter the total between date but i don't have any idea how to do that .
i have a DataGridView3 linked to database of access with adapter and i update it like that's
Me.Table2TableAdapter.Update(Me.Articlevendu1DataSet1.Table2)
useful information :
DataGridView5.Item(1, i).Value is the column of value of earning of every transactions .
DataGridView5.Item(2, i).Value column filled by date and time of earning of every transactions .
Total_textbox.text is where i need to filtre total of transaction "by a single day" .
i need help please
Think you
|
|
|
|
|
What have you tried? Where are you stuck?
|
|
|
|
|
<pre>Dim dtDate1 as DateTime = DateTime.Parse(date1.text)
Dim dtDate2 as DateTime = DateTime.Parse(date2.text)
Dim cmd1 As OleDbCommand = New OleDbCommand("SELECT * from YourTable where stdate Between #" & _
dtDate1.ToString("MM/dd/yyyy") & "# And #" & _
dtDate2.ToString("MM/dd/yyyy") & "#",con)
i'm trying something like that but i need to use a calender to choose the date between .
|
|
|
|
|
Your code is SQLInjection vulnerable.
[EDIT] Please read Dave's comment below to find out why.[/EDIT]
To avoid that you have to use parameters, for example:
Dim dtDate1 as DateTime = CalendarControl1.Value
Dim dtDate2 as DateTime = CalendarControl2.Value
Dim cmd1 As OleDbCommand = New OleDbCommand("SELECT * FROM YourTable Where stdate BETWEEN @dt1 AND @dt2;")
cmd1.Parameters.AddWithValue(@dt1, dtDate1)
cmd1.Parameters.AddWithValue(@dt2, dtDate2)
For further details, please see: OleDbCommand.Parameters Property (System.Data.OleDb)
[EDIT2]
Assuming that you want to...
Quote: filtre total of transaction "by a single day" .
You have to use COUNT() function and convert datetime data time into date:
SELECT CONVERT(DATE, stdata), COUNT(*) AS TotalCountOfTransaction
FROM TransactionTable
GROUP BY CONVERT(DATE, stdata)
[/EDIT2]
Above query returns the count of transaction for every single day. If you would like to define the range of dates, use WHERE clause.
modified 9-Jan-18 11:02am.
|
|
|
|
|
OP has declared dtDate1 and dtDate2 as Date objects then used ToString to build the SQL statement - this is not vulnerable to an injection attack. IF, by some nefarious means malicious code was sent via the calendar controls, it would not convert to a date, and even if it did, on being converted back to a string would be harmless at worst.
Neither does your reply help with the OP's problem.
I fully agree with the principle of using parametized queries as a rule, but not every concatenated string is vulnerable.
|
|
|
|
|
The date controls may not expose the query to SQL Injection attacks but the pattern the OP used is indicative of the string concatenation pattern being used in all of his queries, which will be vulnerable.
The pattern is seen so commonly around here that M's response is a standard reaction to seeing the pattern.
|
|
|
|
|
Thanks!
I wouldn't be able to say it better.
|
|
|
|
|
Well...
I've updated my answer. Thanks for your valuable comment. As to my statement "your code is SqlInjection vulnerable" i believe that Dave's comment reflects on my point of view.
|
|
|
|
|
OK - I'm sorry if I came over a bit arsey... of course parametrised queries are the right approach. Nevertheless there are occasions when they are not necessary and it's just as easy to write the SQL directly, and personally I see little harm in that.
|
|
|
|
|
OK.
Cheers
Maciej
|
|
|
|
|
There's not really enough information here to help - but in general you can get a total either by using the SUM function in a SQL query
SELECT SUM(number_or_currency_field) FROM table_name WHERE etc or you can get the sum from your datagrid or grtidview either by adding the values in the appropriate cells after databinding, or adding them as you go in the rowdatabound event.
|
|
|
|
|
Dear all
By Excel VBA, how is it possible a button clicking into a Web page rendered by the new versions of FireFox (48+)?
Is there any javascript to be executed through an Excel VBA code?
Thanks in advance for any helps or suggestions on this issue.
Regards
E.C.
|
|
|
|
|
It depends on many factors...
|
|
|
|
|
Hi,
How can I find the current state of a listviewgroup?
What I found
Public Function GetgroupColapseState(groep As Integer) As Boolean
If Environment.OSVersion.Version.Major < 6 Then Return False
Dim GrpId As System.Nullable(Of Integer) = GetGroupID(Me.Groups(groep))
Dim statemask As Integer
<pre>
Dim nreturn As Integer = SendMessage(Handle, LVM_GETGROUPSTATE, groep, statemask)
End Function</pre>
is not working
LVM_FIRST = &H1000
LVM_GETGROUPSTATE = (LVM_FIRST + 92)
I want to not print the collapsed groups
Jan
|
|
|
|
|
Hi,
Is there nobody who can help.
Are all programmergeniusses on holyday?
Jan
|
|
|
|
|
SendMessage(IntPtr hWnd, int msg, int wParam, int lParam) , when msg = LVM_GETGROUPSTATE wil return a bit flag value expressing the group state of the group whose id = wParam. lParam contains a bit flag value expressing which group states are allowed.
So, first is to get something useful for these bit flag values. This enum can help:
<Flags()> _
Public Enum GroupState
LVGS_NORMAL = 0
LVGS_COLLAPSED = 1
LVGS_HIDDEN = 2
LVGS_NOHEADER = 4
LVGS_COLLAPSIBLE = 8
LVGS_FOCUSED = 16
LVGS_SELECTED = 32
LVGS_SUBSETED = 64
LVGS_SUBSETLINKFOCUSED = 128
LVGS_ALL = 65535
End Enum
(source: ObjectListView[^])
So, here are the points you could try:
- use GrpId.Value . This makes a big difference. If GetGroupId returns null, there is no point calling SendMessage.
- make stateMask a GroupState value, not a simple integer value, and give it a meaningful masking value (GroupState.LVGS_ALL for example).
- interpret the return value of SendMessage as a GroupState value.
In short:
Dim stateMask As GroupState = GroupState.LVGS_ALL
Dim GrpId As System.Nullable(Of Integer) = GetGroupID(Me.Groups(groep)
Dim result As GroupState
If (GrpId.HasValue)
result = (GroupState)SendMessage(Handle, LVM_GETGROUPSTATE, GrpId.Value, (int)stateMask)
End If
"I'm neither for nor against, on the contrary." John Middle
|
|
|
|
|
Thanks
this is the working result
Public Function GetgroupColapseState(ByVal lstvwgrp As ListViewGroup) As Boolean
If Environment.OSVersion.Version.Major < 6 Then Return False
Dim GrpId As System.Nullable(Of Integer) = GetGroupID(lstvwgrp)
Dim stateMask As ListViewGroupState = ListViewGroupState.all
If (GrpId.HasValue) Then
Dim result As ListViewGroupState = SendMessage(Handle, LVM_GETGROUPSTATE, GrpId.Value, stateMask)
Return (result And ListViewGroupState.Collapsed) = ListViewGroupState.Collapsed
End If
End Function
I wasn't giving as statemask
happy again
Jan
|
|
|
|