|
-
Feb 1st, 2010, 05:13 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Database Problems
I have a database that Has 72 records in it.
The database I created is sorted by name I created a sort routine for this.
Any way my problem is that now that I added the 72 record I get a return error on my files. I mean there out of sequence. If I do 71 then it is fine the min I add a record it screws up.
Any suggestion?
-
Feb 1st, 2010, 05:47 AM
#2
Thread Starter
Hyperactive Member
Re: Database Problems
I Was trying to extract file by using this but got screw up.
Record_Sets.Open "SELECT " & Table_Title(1) & " WHERE Num = '" & T & "' ORDER BY Num", Data_Connection(1), adOpenStatic, adLockReadOnly, adCmdText
-
Feb 1st, 2010, 06:10 AM
#3
Re: Database Problems
it is unnecessary to store records in any order, the only way to do it is to delete all records and readd in the sorted order,
as you can return a recordset by order on any field, i does it matter what order the records are in
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Feb 1st, 2010, 06:15 AM
#4
Fanatic Member
Re: Database Problems
SELECT * FROM SOME_TABLE_NAME ORDER BY SOME_FIELD_NAME
You can replace the * with required field names if you don't want all fields.
-
Feb 1st, 2010, 06:23 AM
#5
Thread Starter
Hyperactive Member
Re: Database Problems
Does this field name got to be a varible?
-
Feb 1st, 2010, 06:26 AM
#6
Thread Starter
Hyperactive Member
Re: Database Problems
I have alot of data that goes with the file and that is the reason for the file sort.
-
Feb 1st, 2010, 06:36 AM
#7
Re: Database Problems
Does this field name got to be a varible?
no, the name of the field you want sorted by, but it can be passed as a variable
I have alot of data that goes with the file and that is the reason for the file sort.
what does this mean? a lot of fields for the table or large amounts of data in fields
as ian pointed out you do not need to return all fields each time, but can just select the fields needed for a particular task
select name, address1, address2, state from customers order by state
(i think that is right, i have not done any database code for a while)
you can also return subsets of data using where
select name, address1, address2, state from customers order by state where pcode > 4999
72 records is a micro database, you could be working 72000 or more
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Feb 1st, 2010, 06:45 AM
#8
Thread Starter
Hyperactive Member
Re: Database Problems
I figgered out how to extract the data field for the record.
My problem now is that the database is not returning the records as stored.
I use access to look at the data base and all file are in order.
but when I use the
RRR.MOVEFIRST
RRR.MOVE 1-1
Method of extracting then I get the error on certain records.
Blowing my mind.
-
Feb 1st, 2010, 07:32 AM
#9
Re: Database Problems
Post the code you are using, and the details of the error, and which line shows the error....
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 1st, 2010, 10:22 AM
#10
Fanatic Member
Re: Database Problems
 Originally Posted by westconn1
select name, address1, address2, state from customers order by state
(i think that is right, i have not done any database code for a while)
Yes, that is correct.
 Originally Posted by westconn1
you can also return subsets of data using where
select name, address1, address2, state from customers order by state where pcode > 4999
I work with databases all the time but I'm having a 'blonde' moment but isn't it usual to but the WHERE statement before the ORDER BY
-
Feb 1st, 2010, 03:11 PM
#11
Re: Database Problems
I work with databases all the time but I'm having a 'blonde' moment but isn't it usual to but the WHERE statement before the ORDER BY
quite likely
from msdn
Syntax
SELECT fieldlist
FROM table
WHERE selectcriteria
[ORDER BY field1 [ASC | DESC ][, field2 [ASC | DESC ]][, ...]]]
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Feb 1st, 2010, 04:06 PM
#12
Re: Database Problems
Duplicate threads merged - please post each question (or variation of it) only once. If you think you have posted in the wrong forum, PM a moderator to ask them to move it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|