Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Data1 Sort By Month Work But It Upgrade The Data HELP

I use this to call data to DBGrid and work
but when I call data by month this upgrade the 1 record
how can I do this to call the record with out upgrading

PS where do I put combobox into this so I can select by name and date not only date

Dim dtStart As Date
Dim dtEnd As Date

dtStart = CDate(DTPicker1)
dtEnd = CDate(DTPicker2)
Data1.DatabaseName = App.Path & "Databasedata97.mdb"

Data1.RecordSource = "SELECT * FROM transmaster WHERE Verk_skrad Between #" & Month(dtStart) & "/" & Day(dtStart) & "/" & Year(dtStart) & "# AND #" & Month(dtEnd) & "/" & Day(dtEnd) & "/" & Year(dtEnd) & "#"


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Data1 Sort By Month Work But It Upgrade The Data HELP
I use this to call data to DBGrid and work
but when I call data by month this upgrade the 1 record
how can I do this to call the record with out upgrading

PS where do I put combobox into this so I can select by name and date not only date

Dim dtStart As Date
Dim dtEnd As Date

dtStart = CDate(DTPicker1)
dtEnd = CDate(DTPicker2)
Data1.DatabaseName = App.Path & "Databasedata97.mdb"

Data1.RecordSource = "SELECT * FROM transmaster WHERE Verk_skrad Between #" & Month(dtStart) & "/" & Day(dtStart) & "/" & Year(dtStart) & "# AND #" & Month(dtEnd) & "/" & Day(dtEnd) & "/" & Year(dtEnd) & "#"


Data1.Refresh - It Don't Work
this is the code from my program and i have a problem with it.

Private Sub SearchBand_Click()

Dim bandsql As String
bandsql = "Select * from cd_serial_numbers where band_name = ' " & txtband.Text & " ' "
Let Data1.RecordSource = bandsql


End Sub

After i press the button it fails to refresh the grid. The error message is:
Run Time error '3078'

The Microsoft Jet Database engine cannot find the input table or query "". Make sure it exits and that its name is spelled correctly.

Now it does exist and yes it is spelt correctly so what is the problem?????


Dll File Doesn't Work After Upgrade To Windows2000

I've just upgraded my system to Windows2000, afterward I reinstiall my
Visual Studio, etc.
The project I'm working on uses one dll file. Now it sometimes give me
run-time errors when I try to call functions from this dll file. But it
worked fine in Windows98.
Can anyone tell me why? Does it mean the dll cannot be use under

I'm very appreciate if someone can help me!
Thanks a lot!

Upgrade Of Database From Access To MSDE Makes Sql Not Work

I have a small program that is taking data from a text file and updating a table in an access database. This was working fine until.... we upgraded the access database to a MSDE database.

Now when my code hits the line of code:myconnection.Execute "delete * from conloc where ContainerID in (select ContainerID from [Text;DATABASE=c:file_extractionTxtPickup].[filqasConLoc.txt]) "
it breaks down and doesn't want to work now that it is working with the MSDE database.
Does anyone know why this is happening or can give me any leads what to research.
Maybe I need to do stored procedures but have no idea how to actually go about it .

Can you help

rgds, Knoxvile

DAO Data Controls (Data1) Not Releasing Memory Please Help
I posted this problem recently and I got the answer that I should substitute ADO controls. However the project is completed and at this point, substituting ADO for DAO is turning out to be pretty sticky. I can't believe that this problem has not been resolved in all the years that DAO has been operational.
If anybody knows how I can get these data controls to release memory properly I sure would appreciate hearing from you. I am using VB6 SP6 on XP.

Thanks. Indio

Algorithm To Work Out Days In A Month
If you are passed a integer representing a year eg intYear = 2001, how could you work out how many days were in a specific month, any month, without a select case statement to select the months.
Private Function GetDaysInMonth(TheMonth as Integer, TheYear as integer) as Integer
Algorithm to go in here
End Function

Any ideas?

How Can I Link Data From Data1 Into 4 DBGrid From 4 Table Select In DBGrid1 ?????
Yes its me agen
Hi folks

Now I wonder How?

I use data1
to read from and save to tatabase to 2 Table and read back to grid

I use

Table customer - with field , NR, Name, Address, Phone,

Its ok to save and read from database

Now I want to Link the NR from name in customer to NR in Table Servise

So when I read customer from data1 into DBGrid1 then I want to see the servise I dit put on the customer in Table Servise into DBGrid2

I use 4 DBGrid in this program ,
DBGrid1 the customer
DBGrid2 Servise
DBGrid3 working time of the customer
DBGrid4 the rent of tools to the customer

I need to lenk all this data so when i select the customer in DBGrid1 i get the rest of the data into DBGrid 2 - 3 - and 4

I use this to call database

Data1.DatabaseName = App.Path & "Databaseilanir97.mdb"
Data1.RecordSource = "TransMaster"
Data1.RecordSource = "Select * From TransMaster Where staða = 'Opið' "

Need Bubble Sort To Read Two Seperate Text Files And Sort Data Into One List
I have two seperate text files, have to read the data from both, such as:

(file one)
2, Tom
5, Bill
3, Tony
7, Charlotte
1, Pedro

(file two)
6, Penelope
8, Joann
4, Mark
10, Jose
9, Gerald

Then open, read and sort the two files, then put that data into combined order (by the number) to come out as one list:

1, Pedro
2, Tom
3, Tony
4, Mark
5, Bill
6, Penelope
7, Charlotte
8, Joann
9, Gerald
10, Jose

My exposure so far with Bubble Sort has been comparing and sorting words that were entered into text boxes. That is the only code I have and does not match this current scenario. Need help with code on opening both files simultaneously and then bubble sorting. I know this needs to be an array.

Can someone tell me what to do or show a similar example I could follow? Thank you for any help.

Upgrade Data Control To ADO
Hello guys,

I have been using data control in my application for database access.
I now want to upgrade my code to ADO.
My code looks like this:

Data1.RecordSource = "Table1"
Data1.Recordset.FindFirst "field1 = " & fieldvalue

If Data1.Recordset.NoMatch then

End If

Can someone please help me upgrade the code above to ADO starting with th
following declarations.

Dim conn as ADODB.Connection
Dim rst as ADODB.Recordset

Set conn as New ADODB.Connection
Set rst as New ADODB.Recordset

With rst

End With
With conn
.Provider = "Microsoft.JET.OLEDB.4.0"
.Open "C:database.mdb"
End With

With rst
.ActiveConnection = conn
.Open "Table1", LockType:=adLockOptimistic
End With



3 Key Sort Doesn't Work

I am getting an Application-defined or Object-defined error on the r.sort section. The sort works fine if I delete key 2 and 3. Can anyone help me with some ideas to make it work.

Here is the code:

Private Sub ok_Click()
Dim s1 As Integer, s2 As Integer, s3 As Integer 'sort column
Dim o1 As Integer, o2 As Integer, o3 As Integer 'sort order
Dim r As Range, Ord As Long

'set the region and initial sort criteria
Set r = Range("A5:k65") '.CurrentRegion

If cboSort1.ListIndex = 1 Then
s1 = 1
GoTo Ord
End If
If cboSort1.ListIndex = 2 Then
s1 = 2
End If
If cboSort1.ListIndex = 3 Then
s1 = 3
MsgBox cboSort1.Text
End If
If cboSort1.ListIndex = 4 Then
s1 = 4
End If
If cboSort1.ListIndex = 5 Then
s1 = 5
End If
If cboSort1.ListIndex = 6 Then
s1 = 6
End If
If cboSort1.ListIndex = 7 Then
s1 = 7
End If
If cboSort1.ListIndex = 8 Then
s1 = 8
End If
If cboSort1.ListIndex = 9 Then
s1 = 9
End If
If cboSort1.ListIndex = 10 Then
s1 = 10
End If
If cboSort1.ListIndex = 11 Then
s1 = 11
End If

If cboSort2.ListIndex = 1 Then
s2 = 1
End If
If cboSort2.ListIndex = 2 Then
s2 = 2
End If
If cboSort2.ListIndex = 3 Then
s2 = 3
End If
If cboSort2.ListIndex = 4 Then
s2 = 4
End If
If cboSort2.ListIndex = 5 Then
s2 = 5
End If
If cboSort2.ListIndex = 6 Then
s2 = 6
End If
If cboSort2.ListIndex = 7 Then
s2 = 7
End If
If cboSort2.ListIndex = 8 Then
s2 = 8
End If
If cboSort2.ListIndex = 9 Then
s2 = 9
End If
If cboSort2.ListIndex = 10 Then
s2 = 10
End If
If cboSort2.ListIndex = 11 Then
s2 = 11
End If

If cboSort3.ListIndex = 1 Then
s3 = 1
End If
If cboSort3.ListIndex = 2 Then
s3 = 2
End If
If cboSort3.ListIndex = 3 Then
s3 = 3
End If
If cboSort3.ListIndex = 4 Then
s3 = 4
End If
If cboSort3.ListIndex = 5 Then
s3 = 5
End If
If cboSort3.ListIndex = 6 Then
s3 = 6
End If
If cboSort3.ListIndex = 7 Then
s3 = 7
End If
If cboSort3.ListIndex = 8 Then
s3 = 8
End If
If cboSort3.ListIndex = 9 Then
s3 = 9
End If
If cboSort3.ListIndex = 10 Then
s3 = 10
End If
If cboSort3.ListIndex = 11 Then
s1 = 11

'set the initial order as ascending or descending

If frmSort.chkBox1.Value = True Then
o1 = 1
Else: o1 = 2
End If
If frmSort.chkBox2.Value = True Then
o2 = 1
Else: o2 = 2
End If
If frmSort.chkBox3.Value = True Then
o3 = 1
Else: o3 = 2
End If

'perform sort
Worksheets("Sheet1").Range("A1:C20").Sort _
Key1:=Worksheets("Sheet1").Range("A1"), _

End If

'protect the document

End Sub

Private Sub UserForm_Initialize()

With frmSort.cboSort1
.RowSource = ""
.AddItem "(None)"
.AddItem Range("A4").Text
.AddItem Range("B4").Text
.AddItem Range("C4").Text
.AddItem Range("D4").Text
.AddItem Range("E4").Text
.AddItem Range("F4").Text
.AddItem Range("G4").Text
.AddItem Range("H4").Text
.AddItem Range("I4").Text
.AddItem Range("J4").Text
.AddItem Range("K4").Text

End With
With frmSort.cboSort2
.RowSource = ""
.AddItem "(None)"
.AddItem Range("A4").Text
.AddItem Range("B4").Text
.AddItem Range("C4").Text
.AddItem Range("D4").Text
.AddItem Range("E4").Text
.AddItem Range("F4").Text
.AddItem Range("G4").Text
.AddItem Range("H4").Text
.AddItem Range("I4").Text
.AddItem Range("J4").Text
.AddItem Range("K4").Text
End With
With frmSort.cboSort3
.RowSource = ""
.AddItem "(None)"
.AddItem Range("A4").Text
.AddItem Range("B4").Text
.AddItem Range("C4").Text
.AddItem Range("D4").Text
.AddItem Range("E4").Text
.AddItem Range("F4").Text
.AddItem Range("G4").Text
.AddItem Range("H4").Text
.AddItem Range("I4").Text
.AddItem Range("J4").Text
.AddItem Range("K4").Text
End With
End Sub
Edit by italkid: The use of [vb]][ and [/vb] tags makes your code better readable...

How Does A Selection Sort Work??
i need to make a sort program using a selection sort..anyway

could someone please explain how it works and if possible give me some code/pseudocode

Sort Doesn't Work Right
My sort isn't working right, right now it is only printing one record.

Private Sub SortList()
ReDim sortArray(100) As String
Dim unsortArray(100) As String
numEntries = Counter
sortCount = numEntries
start = Timer
emptyLoc = 1
PageCount3 = 1
Do While sortCount > 0
minKeyLoc = 1
currEntryLoc = 1
Do While currEntryLoc < numEntries
currEntryLoc = currEntryLoc + 1
If Left(unsortArray(currEntryLoc), 4) < Left(unsortArray(minKeyLoc), 4) Then
minKeyLoc = currEntryLoc
End If
sortArray(emptyLoc) = unsortArray(minKeyLoc)
emptyLoc = emptyLoc + 1
sortCount = sortCount - 1
unsortArray(minKeyLoc) = "999999999 "
mainoutct3 = mainoutct3 + 1
If mainoutct3 > 49 Then
PageCount3 = PageCount3 + 1
mainoutct3 = 0
End If
Print #4, vbTab & IdNum1 & vbTab & CarName
finish = Timer
totaltime = finish - start
End Sub

Help Please I Need To Sort A Table But This Code Does Not Work?
I have problems with this sort this does not update my records in my database. I can not find what wrong is on it.

I want to sort a table in my database any time the user clcik on a button and answer

Dim dbs As Database
Dim rst As Recordset
Dim rstSort As Recordset
Dim strName As Variant

strName = _
Trim(InputBox("Enter Last Name first letter eg: [A] for Anderson"))
If strName = "" Then Exit Sub

Set dbs = OpenDatabase("C:AddressAddress.mdb")
Set rst = _
dbs.OpenRecordset(strName, _

With rst
SortOutput "Original Recordset:", rst
.Sort = "LastName, FirstName"
' Print report showing Sort property and record order.
SortOutput _
"Recordset after changing Sort property:", _
' Open new Recordset from current one.
Set rstSort = .OpenRecordset
' Print report showing Sort property and record order.
SortOutput "New Recordset:", rstSort
End With


End Sub

Function SortOutput(strTemp As String, _
rstTemp As Recordset)

With rstTemp
Debug.Print strTemp
Debug.Print " Sort = " & _
IIf(.Sort <> "", .Sort, "[Empty]")

' Enumerate Recordset.
Do While Not .EOF
Debug.Print " " & !LastName & _
", " & !FirstName

End With

End Function


Sort And Display Command Buttons Won't Work
Can somebody help me as to why they don't?

Show A Msgbox Asking If They Want To Upgrade When I Upgrade My App
im making a program, if im going to add more options sometimes and i want the people that have the program to get like an updated version how would i do that?

like when they open it shows a msgbox asking if they want to upgrade

My Radix Sort Implementation - Why Doesn't It Work In All Scenarios?
Hi Everybody

I now seem to have sucessfuly implemented (both for 1 and 2 dimensional arrays) a VBA (Excel) code for Radix sorting for stirngs using the base code from Dave Ring. The code for 1 dimensional strings is attached herewith for your immediate reference.

There seems to be some glitch somewhere in it however, for it seems to work for 'n' number of string when data is loaded in to the array one way (dynamically generate random strings and load array with these string - tested and works for upto 500000 strings in 1 column array) but doesn't work (comes with an overflow error) when the data comes another way.

These are some of the other scenarios where the code succeeded & failed (these are all in the context of data in 1 column array) :-

Succeeded when the data was read from an Excel spreadsheet in one pass but failed when read in more than one pass. For example, when I read 50000 or 65000 strings in one pass from an Excel spreadsheet, it worked perfectly, no problems. But when I tried to read say 100000 or 130000 strings by reading the same 50000 or 65000 strings twice and loaded them in to the array, the code failed and came up with the overflow error.

Succeeded when a 100000 strings were read from a .txt file and loaded in to an array. The .txt file was writtent to earlier using the Print # statement. However, the number of strings were doubled to 200000 strings, it failed again with the overflow error. But it successfully sorted 500000 strings when the strings were dynamically and randomly generated as explained earlier.

Any ideas what is happening here and what can I do to fix this?

The VBA (Excel) code is provided on the spreadsheet itself as the text was too long - only the version of 1 column array is provided as this stage. At the moment this is on Option Base 1 since the original code from Dave Ring uses Option Base 1. I have subsequently modified it for Option Base 0. The code for 2 dimensional array can also be provided if desired. The spreadsheet with a sample 50000 strings is all attached for immediate reference.

I have tried to get in touch with Dave Ring but couldn't.

Best regards

Deepak Agarwal

Dynamic Array-Add Data Check Data, Sort Data
Not sure really how to do this.
Got a column of numbers, some may be double.
want to check each number from the column
if its in the array go to next if not add it to the array
Then sort when done.

was reading and found arraylist and all sorts of stuff. kinda confused.

How should i declare the array?
Can i pass the array into a function
how do i find the length of the array

dim ItemsArray() as integer

How Can I Accumulate Data By Month Or Day ?
If I have a recordset (id, date, amount) and id can be dupliate. How can I accumulate amount by id and date(by month or day) ?

How To Group Data In Month?
Now i had group my data in year, my report will only show all the data in year.
But if i want to group data in month to make all data show in that month only, how to modifyt my sql statement?
Example: now the database consits of MARCH data, when it reach APRIL, it will no data to show in report.

report: rptstockonhand1
source: qrystockOnHand1 (make up of qryLotOutput and qryTaken)

this report is to show the stockonhand, it is quantity created - quantity taken..

below is my query

SELECT [tblProduct].[LineStator], [tblLotCreated].[ProductNo], [tblProduct].[Model], Sum([tblLotCreated].[QtyCreated]) AS SumOfQtyCreated, [tblLotCreated].[StoreLocation], Format$([tblLotCreated].[DateCreated],'yyyy') AS [Year], [tblLotCreated].[LotID]
FROM tblProduct INNER JOIN tblLotCreated ON [tblProduct].[ProductNo]=[tblLotCreated].[ProductNo]
GROUP BY [tblProduct].[LineStator], [tblLotCreated].[ProductNo], [tblProduct].[Model], [tblLotCreated].[StoreLocation], Format$([tblLotCreated].[DateCreated],'yyyy'), [tblLotCreated].[LotID];

SELECT [tblTaken].[ProductNo], Sum([tblTaken].[QtyTaken]) AS SumOfQtyTaken, Format$([tblTaken].[DateTaken],'yyyy') AS [Year]
FROM tblTaken
GROUP BY [tblTaken].[ProductNo], Format$([tblTaken].[DateTaken],'yyyy');

SELECT [qryLotOutput].[Year], [qryLotOutput].[LotID], [qryLotOutput].[ProductNo], [qryLotOutput].[LineStator], [qryLotOutput].[SumOfQtyCreated] AS SumOfSumOfQtyCreated, IIf([qryTaken].[SumOfQtyTaken] Is Null,0,[qryTaken].[SumOfQtyTaken]) AS SumOfSumOfQtyTaken, [qryLotOutput].[Model]
FROM qryLotOutput LEFT JOIN qryTaken ON ([qryLotOutput].[ProductNo]=[qryTaken].[ProductNo]) AND ([qryLotOutput].[Year] Like [qryTaken].[Year])
WHERE [qryLotOutput].[Year]=year(now())
ORDER BY [qryLotOutput].[Year];

how to modify it?

Format Month In Date Data

I have a problem - I am extracting dates from the database but the date format is dd/mm/yyyy. What I need is to format the date to read dd MMM yy.

I have been reading and looking up on the web. I know that the "mm" must be extraced by the use of DatePart, formatted to MMM and then replaced into the date, but I have no idea where to start this process.

Any help or direction as to where I should look for the information to complete this process would be appreciated.

How To Extract Data For Selected Month
please tell me what should be the logic of saving data in database for each months? should i save in one table or there is any other simple and good way to do this? if i save data in one table only then how will i get only selected month data while navigating Recordset MovePrevious, MoveNext, MoveFirst, MoveLast method. only selected month data should navigate on these button. please tell me the simplest way to do this. i need this solution urgently.

Year And Month And Data Search
Hello Everyone! Im new in VB-Access development and I have a project in school about database programming. The program should compute and display the total number of years and month based on the system date, it should be displayed in a textbox. Here's an example:

Let say the system date = Feb 24, 2007 and the entry date = April 24, 2005

the display output should be:
1 year and 10 months

Also, about the search button, when the a string has been input, it will display all the records with the same string... Please Help! Thank you very much to all!

QUERY That Show Data For Current Month
1. Please tell me that if I have 1 table in MS Access with several DATE record & I want current month record. What will be the SQL STATEMENT?

2. Please tell me that I have form on ASP page with 2 text boxes each containing day,year respectively and 1 combo box containing month name.
How I can save these values in a variable and compare 2 date so that I can get data(MS Access) from table between these dates.

HELP: Solution For Posted Date The 15th Of The Month OR 1st Of The Following Month
Hi guys

could you help what would be the best way to implement this logic

If ToDate is May 14 2008 then posted date is 20080515
and if ToDate is May 31 2008 then posted date is 20080601

Basicly I would like to create a logic that would work like this
ToDate = 20000114 THEN PostedDate = 20000115 <-- The 15th of the same month

ToDate = 20000131 THEN PostedDate = 20000201 <-- The First of the following month

ToDate = 20001231 THEN PostedDate = 20010101 <-- The year Change (The first of the following month and year)

Thank you

User Choose A Month And I Find Out How Many Days In That Month
Hi guys,
I have a combo box with the 12 months of current year. Eg, January, February, etc, etc. (not in number 1-12)
Now, once the user chooses any month I have to find out how many days are in that month, and
first and last day of that month.

The problem is that I don't have the date, all I have is january to december.

Can you help me please?

thank you very much!



Grouping Method Skipping The Data Which Is Not Present In The Month .. Please Help
hi experts

i am trying to fix my problem from the last 4 months but i got only disappointment
i have tried asking before .. i got good replies but not the solution and i really need to fix the problem that i am facing and i only can get it with your participate ..... please i need it badly and need your prompt attention

this time i will show you the exact steps that i am performing in my Crystal Report

First step:

'Creating a formula with name @note and adding the folowing formula

Left({ordermaster.Notes},3 ) 'this is for getting only first 3 character of the Field Notes

Second Step:

'Creating a formula with name @ErrorLabel and adding the folowing formula

if {@Note} = "LO:" then 'Late Orders'
else if {@Note} = "UE:" then 'Undefined Errors'
else if {@Note} = "IO:" then 'Incorrect Orders'
else if {@Note} = "IP:" then 'Incorrect Price'

Third Step:

adding the following formula in the Group Selection Formula Editor

{@Note} in ["LO:","UE:","IP:","IO:"]

Fourth Step:
now i am inserting groups

first, i am grouping ordermaster.orderintime 'ordermaster is the table name and orderintime is field and this section is printing for each month

second, i am group @ErrorLabel 'the formula contains the above record as shown

now in the summary i am counting @Errorlabel by selecting Group#2 ErrorLabel-A

now each time i run the report i get the report as it is attached with file name BadReport .. please find out the attached file

open the file and see why it is badreport

if you see month Aprill 2005

it shows that
Late Orders = 14
Undefined Errors = 4

and then it checks for another month which is May

as i want to show all my Errors which is availabe in @ErrorLable , the data i want is should be as below

lets take the same month

Aprill 2005

Late Orders = 14
Undefined Errors = 4
Incorrect Price = 0
Incorrect Order = 0
^^^^^^^^^^^^^^^^^ i want to display all four errors every time in every month, if no data is present then still it should print other errors which are not availabe in the month and count of error should print 0

i know grouping only take the values which are present in the month ... but ofcourse there should be some thing that must print error name and along with 0 value

i believe i explained it very well and hope i can get solution.


Edited by - _TiGeR_ on 7/9/2005 1:49:45 PM

If Statements To Test For Third Wed Of The Month && Third Thurs. Of The Month
what would be the VB6 code for an if statement that would check for if it's the third wednesday of the month and execute some code based on that. Also would would be the similar code for if it's the third thursday of the month?
thanks in advance,

Not Good With Dates, Need Last Month, Next Month Values
I need a function(s) that will generate "next month" and "previous month" in MMM/YYYY format based a supplied date.

For example, for Jun/1/2006, next month = "July/2006", previous month = "May/2006".

Basically just need to add or subtract 1 from the month part of the date. I tried adding and subtracting the number of days in the month, but some months have 30 days, some 31 days, and of course there is always leap years too.

Sure this is simpler than I am making it, any suggestions on working with the month part of dates?

Mysql Query In Order To Refer The Data By Year And Month??
hi all,

can anyone suggest me on how can i make the user feel easy to check the data within the year and the month chosen by them.what i mean here is, i want the user select the month and year and then the data appear on the mshflexgrid.

Please Help Building Up SQLs For Separating Out Year, Month And Quarter Data From A Table
Hello Ppl..

I want help regarding generating different SQL statements.....for the following kind of table......

So what I want to do is to run queries to find out monthly, quarterly and yearly data separately.....

1) jan'05, feb'05, ..... jan'06, feb'06......are monthly data...

so what I want is (logically)

when month is selected on the form for the output data,
ssql = "Select s.*jan* AND s.*Feb* AND s.*Mar*...........& _
         "INTO [MONTH]" & _
         "FROM [" & Me.PCYcle & "] s "

but SQL does not support this kind of * statements. I am sure that month field will include Jan, Feb, Mar, that kind of string , but it can be for year 05, 06, not sure about the year part.

2) 05'Q1, 05'Q2, ..... 06'Q3, 06'Q4......are quarterly data...

so in this case,

when quarter is selected on the form for the output data,
ssql = "Select s.*Q*" & _
         "INTO [QUARTER]" & _
         "FROM [" & Me.PCYcle & "] s "

but SQL does not support this kind of * statements. I am sure that month field will include Q1, Q2, Q3, Q4 that kind of string , but it can be for year 05, 06, not sure about the year part.

3) 05'Y, 06'Y, 07'Y......are yearly data...

so in this case,

when year is selected on the form for the output data,
ssql = "Select s.*Y*" & _
         "INTO [Year]" & _
         "FROM [" & Me.PCYcle & "] s "

but SQL does not support this kind of * statements. I am sure that month field will include Y in all year data column, but it can be for year 05, 06, not sure about the year part.

Please help building up this kind of logic and SQL statements... I am not sure about the year part in columns, it can be can not specifically define columns like,

select s.05'Q1, s.06'Q2, s.07'Q3........

Because I am developing this application for all kind of input tables and they may have different year range, so need some kind of dynamic way to generate this.

Thanks in advance....

Bubble Sort, Quick Sort And Radix Sort
Greeting everyone,

Can anyone help me on writing a simple program on Bubble sort, Quick sort and radix sort in Visual C?

Get Current Month And Previous Month?
i want to load monthname in combo box such as: January, February, March up to December. and when i click Monthname(example August) in the combo box it will display all month (August) in listview.

In my listview i have the data of month such as: March 01, 2005,March 20,2005,April 15,2005,May 23,2005,July 16,2005,August 14,2005.

kindly help on how to get current month and previous month listed in combo box.

How Would I Sort This Data ?
My brain's been mush the past few days, and I just cannot seem to sort this data.

I have the following UDTs

VB Code:
Private Type installedApplicationsType    displayName As String    UninstallString As String    publisher As String    InstallLocation As String    DisplayVersion As String    URLInfoAbout As StringEnd Type Private Type reportInfoType    aReportOnComputer As String    bOperatingSystem As String    cCreated As String    dUserLoggedOnAs As String    eInstalledApplications() As String    fHardWareInfo As hardwareInfoType    gInstalledApplications2() As installedApplicationsTypeEnd Type Private systemReportInformation() As reportInfoType

You can comment out fHardWareInfo as its of no relevence.
Anyway yeah I have an array of reportInfoTypes.

I'm generating a report on the applications installed on computers.
Each array index in systemReportInformation() is a different computer.

I want to output a report, but output by Publisher.
So, lets say there are a number of computers, with say Office XP Pro, and Internet Explorer, and some other packages by Microsoft and others installed.

The report would look like this (just a bog standard .txt file)

Microsoft Corporation
Office XP Professional
Internet Explorer 6
Visual Studio 6.0 Enterprise

Adobe Acrobat Reader
Adobe Acrobat

Fireworks Studio
blah blah blah


But I can't for the life of me figure out how to do it.
Granted I had difficulty even getting dressed this morning, so its not very surprising

Oh yeah, Publisher is the name of the company that makes the product, and DisplayName is the name of the product itself.

Sort And Add Data
I am completely new to this, but here is what I am trying to do. I am not looking for the exact code here, but maybe someone to point me in the right direction and perhaps to a place where I can read up on VB?

I need to import data from a web page from multiple days. (this I can do )
THe data is a list of names and a number.
I then need to import data from another similar web page that has a similar list of names and numbers.
If the name is the same as one already imported, I need to add the numbers together.
If the name is not there, I need to add it to the list.
(then repeat for a bunch of web pages with this kind of data)

This is the beginning part of what Im trying to do, and I think I can figure it out if I get this far, but like I said I am new to this. Maybe a beginners web page or some type of help would be appreciated.


Unable To Sort Data
On a worksheet, I have a button that executed the below code. This works fine. I also want this code to be executed when the other worksheet is selected.

Range("A8:Y500").Sort Key1:=Range("A8"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _

That is currenly in a macro sub, which as I say, works fine. I have also put into worksheet_activate.

The error I get is "the operation requires the merged cells to be identically sized. Strangely, none of the cells I am sorting are merged. My thinking is that it was trying to sort the worksheet that has just been selected, so I tried the following to no avail;

worksheets("Critical Document Matrix").Range("A8:Y500").Sort Key1:=Range("A8"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _

Any ideas?

Sort Unique Data?

I need help with sorting unique data from an excel spreadsheet.

Let say you have a register of all your friends with their names in column A and their phone number in column B etc, but there are double entries.

How can you sort out a list that only displays the unique friend once, thus remove all double entries?

I have tried working the "Advanced filter" using "unique records only"-function but it doesn’t work or perhaps I am doing something wrong?



Sort Protected Data
I have recorded a macro in Excel 97 sr2 to unprotect a sheet, sort data and protect it again.

Sub sort()
Application.Goto Reference:="all"
Selection.sort Key1:=Range("B22"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
I get the following error...

1004 Unprotect method of Worksheet class failed....

I am not using a password... I did try with one and got the same error?

I read an earlier post with a similar problem and no solution was found there


Copy And Sort Data
How can I copy data from sheet1 to sheet2 and only copy cells with information in them. The data in sheet1 is in columns A,B,C,D,E,F,G and H, but the H col. has blanks in some places. The data in the rows, on sheet1, starts at cell "A13" and goes to an unknown row because the data inputed changes with each job. What I need is to highlight and copy from sheet1 cell "A13:H?" and paste to sheet2, then sort the information by rows(8:?). I have the code that I've developed below, but as you can see it has set ranges and I need it to change. I've put remarks next to the portion of the code that I need help with. I know I need a variable, but I'm not sure how to go about it. Thanks for any suggestions.

Sub CopySortData()
With Worksheets(1)
.Range("A13:H60").Select 'NEED RANGE TO BE SET FROM "A13" TO "H?"..H needs to be variable
End With

With Worksheets(2)
.Range("A9:H?").Select 'NEED RANGE TO BE SET FROM "A9" TO "H?"
Selection.SORT Key1:=Range("E9"), Order1:=xlDescending, Key2:=Range("C9") _
, Order2:=xlDescending, Header:=xlYes, OrderCustom:=1, MatchCase:=False _
, Orientation:=xlTopToBottom
Application.CutCopyMode = False
End With
End sub

Need To Sort XML File Data
i am designing an application and in that i need to Sort the Xml file containts i am using microsoft DOM object and tried through Xsl also but fail to save data to my XML file so plz help me with code some site with sorting XML data
will b thankfulllll

Is There Any Way To Sort The Data In A Picturebox?
In the program I am creating for an assignment, I need to retrieve info from a database, then print it out to a picturebox on another form. Since I did not know how to do that, I printed the data out to a textbox first, then declared a variable word = word & textbox.text to remember all the data input. I then print it out to the picturebox on the other form. However, I am printing out grades, and they need to be sorted from highest number to lowest, and I don't know how to do that in a picturebox, and since I am only retrieving one piece of data at a time from SQL (the grade, which is required to be selected from a database), I don't know how I would sort it with SQL. If anyone could help me sort the info in the picturebox, or before it went into the picture box, it would help me out a lot. By the way, is there any way to print a listbox out to a picturebox?
Thanks for any help!

Sort File Data
i have a text file that stores files information. Each line of the text file has file transfer date, filename, filesize and datecreated.

since the text file has many lines (around 100), i have to sort the data in this text file according to file transfer date.

can anybody gives me an idea how to sort the data. Note: the whole line of data need to swap along with the file transfer date.

Sort Data In The Array!
Dear VBCity Friends,

I am using 2 sql coding to retrieve data from few tables (SQL Server 2000) & store in the dynamic array!
Examples: ->
Code:items(0) = "C" timeCheck(0)="09/15/2005 12:26:23 AM"
items(1) = "I" timeCheck(1)="09/16/2005 4:32:00 PM"
items(2) = "A" timeCheck(2)="09/15/2005 5:54:12 PM"
items(3) = "J" timeCheck(3)="09/15/2005 3:56:59 PM"
items(4) = "B" timeCheck(4)="09/15/2005 4:19:30 PM"
items(5) = "G" timeCheck(5)="09/17/2005 3:37:00 PM"
items(6) = "H" timeCheck(6)="09/15/2005 2:24:05 PM"
items(7) = "D" timeCheck(7)="09/20/2005 4:26:25 PM"
items(8) = "F" timeCheck(8)="09/15/2005 10:33:30 AM"
items(9) = "E" timeCheck(9)="09/19/2005 10:16:01 AM"

Each arrays in each rows are together, so, how am i going to sort the timeCheck (AND the items will follow it!)

Finally, i will display the sorted "items(...) & timeCheck(...) in the listbox!

Please help, friends!

Many Thanks!


Sort Excel Data
Hi there,
how can I sort the rows of a spread sheet based on the contents of one of the fields conatined in each row from my vb application.

I have a number of rows with two cells. One cell have the name of the person and the other has the sex of the person and they are not ordered. I would to order them by sex, ie all men and then women

Any help would be great

How Can MSHFlexGrid Sort Data
I'm now using MSHFlexGrid to retrieve the data list

How can I sort the data by click on each header column???

Hidden Control To Sort Data?
I decided to make my own listview in HTML that will display in a webbrowser control in order to be able to customize the list layout which is impossible with the listview control.

I will need a way to be able to store and sort the table of data that will display in my HTML list. Is there a control I can put that would be hidden at runtime where I could store the data and that would handle sorting and I'd have code to update the html list from the data in the table. I could do it by keeping the listview control and hiding it, but I was wondering if there's any control or another way that would be better?


Adodc1 Data Sort Order
I am using an adodc1 object that is used via a dbcombo box to autopopulate. If I INSERT an entry into the database and use the command

The new data is listed but the items in the DBCOMBO box are not sorted into any order. How can I force the adodc object to sort in an ascending order?

Data Object Doesn't Sort Right
I have a Data object and I'm using a "Acces 2000"-file as a database. My first colum is an index number from 50 to 149, but my program starts showing them from index 120 and ends to index 99. How can I get my program to start from 50 and to end on 149?

Sort Data In An Excel File
I want to know how I can sort the contents of an excel file. The first row of my file is a heading row. So I want to sort all rows from 2nd row till the end of records. Sorting should be based on (and only on) the values in the first column (total there are 6 columns). Please tell me how to do it.


Easiest Way To Sort A Table Of Data In VB
I have an idea in my head, not sure how to push into code....

I have 8 teams with wins and losses. What component is best for having the standings for the variables sorted for each new week.

I have a program that simulates a season... It plays the weeks game on one form, then the next form loads. I would like for the team with the best record, regardless of were they are at the beginning, to be at the top and then in descending order from most wins to least amount.

So I guess what I'm asking is, how can I implement an Excel sheet into VB, have it sort by a certain category everytime the new form loads the variables into the table?

I'm not giving you much so any help or suggestions is greatly appreciated.

Copyright © 2005-08, All rights reserved