Results 1 to 12 of 12

Thread: [RESOLVED] Database Problems

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Resolved [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?
    Don
    (OLD DOS Programmer)

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    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
    Don
    (OLD DOS Programmer)

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  4. #4
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    739

    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.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Re: Database Problems

    Does this field name got to be a varible?
    Don
    (OLD DOS Programmer)

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Re: Database Problems

    I have alot of data that goes with the file and that is the reason for the file sort.
    Don
    (OLD DOS Programmer)

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    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.
    Don
    (OLD DOS Programmer)

  9. #9
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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,...

  10. #10
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    739

    Re: Database Problems

    Quote Originally Posted by westconn1 View Post
    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.

    Quote Originally Posted by westconn1 View Post
    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

  11. #11
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  12. #12
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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
  •  



Click Here to Expand Forum to Full Width