Page 2 of 2 FirstFirst 12
Results 41 to 67 of 67

Thread: Save to database.. Please help

  1. #41

    Thread Starter
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: Save to database.. Please help

    see next post..
    Last edited by elRuffsta; Sep 20th, 2014 at 02:11 PM.

  2. #42

    Thread Starter
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: Save to database.. Please help

    @ IkkeEnGij

    first: it doesn't matter how many or to what extent i edit my post(s) - it's my right to.

    secondly: i don't care who or how many people can see all the editing i have done to any of my posts - i was a mod too.. several times, so i know it can be done - bottom line is i still don't care.

    thirdly: who does or does not use my app is none of your concern or anyone else's on here now is it? just sux that everone has access to my idea/program they didn't come up with on their own! that's the only part i hate..

    you wanna know how i want my program to work as you said in your last post? read post #13, also look at the program i uploaded.. oh, and since you complained about contacting you in a PM.. mine is open to everyone.. i don't ***** and complain like you when someone contacts me for any reason.. unless they are rude or inappropriate.. which i wasn't! right now, yes i am being defensive because you sir are acting like a forum bully! put yer coding where your mouth is instead of letting a topic drag on since you think you know it all!!! you say it's easy? prove it!

    let's end this bs once and for all.. yes, i'm calling you out on your coding skills mister know it all.. hey, you put yourself out there - so show us!
    i am completely willing to help you with whatever you want, i am even willing to write your program for you
    i don't need you to write my program, but i am calling you out to make it work the way i want it to since you think it's so easy! or you gonna keep running your mouth and judging me, my skills and my ideas?

    yeah, that's what i thought.. can run his mouth but can't back up what he says..

    fourth: you have a big mouth and are very judgmental - (i laugh because guys like you don't say what they do face to face.. i do! i can back myself up in person.. i say to you on here in public view as i would to your face! i don't hide behind a pc and text tough unlike people like you)..

    you say you are willing to help "even write my program", which i don't need thank you - i have coded and released several without your help in the past.. but yet you say you can.. then put your coding where your mouth is! so yes, i'm calling you out as i would face to face.

    oh, and since you're not gonna help.. stay out of my topics from now on!

    now we wait for his tantrum and still no proof it's as easy he says it is and without any actual help...

    post over! sorry i even started the post.. helpers my a$$ - with the exception of nightwalker83 who actually did attempt. - OFFICIAL REQUEST that someone lock or delete this topic.. pointless at this point.

    @nightwalker83
    i won't PM you anymore since you complained about it - but i thank you for attempting to try to help..tho it was buggy - i still thank you for trying unlike unmentioned names... but you did try, i can respect that.
    Last edited by elRuffsta; Sep 20th, 2014 at 02:40 PM.

  3. #43
    Frenzied Member
    Join Date
    Jun 2014
    Posts
    1,084

    Re: Save to database.. Please help

    you want me to make your program for you ?
    since you refuse to tell how you want your program to work
    i cannot know how you want your program to work

    however i will tell you how to make a program that is usefull to the millions i was refering to

    since you are using an .mdb i assume it is access before 2007
    start microsoft access
    make a new database call it 'elruf.mdb' or whatever you want
    make a new table call it 'SeedTray'
    add a field call it 'SlotNr'
    give it a datatype of longinteger
    make it the primary key (and call the index msaccess creates for you 'SlotNr')
    give it a validationrule of: >0 And <73
    give it a validationtext of: the slot number has to be from 1 to 72 both included
    Default Value= nothing(simply remove whatever there is) probably it was 0
    required=yes
    indexed=yes(no duplicates)

    add a field call it 'Seedname'
    give it the text datatype
    required=no

    add a field and call it 'Memo'

    so now you have created the database and a table called 'SeedTray'
    now to make it easy we are going to fill this tables with SlotNr's from 1 to 72
    open the table
    type under SlotNr: 1
    move cursor down and type: 2
    do this 70 times more
    (if all is well, from here on you only have to move down cursor
    so now you have a database and a table, with for each slot in your seedtray a record

    so lets make the vb program
    start visual basic6
    new..standard exe
    drop a data control on the form
    properties of the data control:
    Connect=Access
    Databasename=the path to the database
    (just click the ellipses and choice)
    RecordsetType=0-Table
    RecordSource=SeedTray

    drop a label on the form
    properties of the label:
    DataSource=Data1
    DataField=SlotNr

    now run the program
    click the arrows of the datacontrol
    a miracle happens

    drop a textbox on the form
    properties of the textbox:
    Multiline=true
    DataSource=Data1
    DataField=Memo


    drop a textbox on the form
    properties of the textbox:
    DataSource=Data1
    DataField=SeedName

    run the program
    and play a bit with it
    now you can fill the SeedTray already with what you want

    now drop an array of command buttons on the form
    index=1 to 72
    Code:
    Private Sub Command1_Click(Index As Integer)
        Data1.Recordset.Seek "=", Index
    End Sub
    
    Private Sub Form_Activate()
        Data1.Recordset.Index = "SlotNr"
    End Sub
    there you go, in no time a program to do what you want

    took me 2 minutes to "write" hihi that program
    took me a lot longer to explain to you

    hope a genius such as you can understand it
    if you had done what i told you in post #12
    or anything what the other participants told you
    it would have been done long ago already
    but i can understand that for a genius such as you that was far to simple

  4. #44
    Frenzied Member
    Join Date
    Jun 2014
    Posts
    1,084

    Re: Save to database.. Please help

    Quote Originally Posted by elRuffsta View Post
    @ IkkeEnGij

    first: it doesn't matter how many or to what extent i edit my post(s) - it's my right to.

    secondly: i don't care who or how many people can see all the editing i have done to any of my posts - i was a mod too.. several times, so i know it can be done - bottom line is i still don't care.

    thirdly: who does or does not use my app is none of your concern or anyone else's on here now is it? just sux that everone has access to my idea/program they didn't come up with on their own! that's the only part i hate..

    you wanna know how i want my program to work as you said in your last post? read post #13, also look at the program i uploaded.. oh, and since you complained about contacting you in a PM.. mine is open to everyone.. i don't ***** and complain like you when someone contacts me for any reason.. unless they are rude or inappropriate.. which i wasn't! right now, yes i am being defensive because you sir are acting like a forum bully! put yer coding where your mouth is instead of letting a topic drag on since you think you know it all!!! you say it's easy? prove it!

    let's end this bs once and for all.. yes, i'm calling you out on your coding skills mister know it all.. hey, you put yourself out there - so show us!


    i don't need you to write my program, but i am calling you out to make it work the way i want it to since you think it's so easy! or you gonna keep running your mouth and judging me, my skills and my ideas?

    yeah, that's what i thought.. can run his mouth but can't back up what he says..

    fourth: you have a big mouth and are very judgmental - (i laugh because guys like you don't say what they do face to face.. i do! i can back myself up in person.. i say to you on here in public view as i would to your face! i don't hide behind a pc and text tough unlike people like you)..

    you say you are willing to help "even write my program", which i don't need thank you - i have coded and released several without your help in the past.. but yet you say you can.. then put your coding where your mouth is! so yes, i'm calling you out as i would face to face.

    oh, and since you're not gonna help.. stay out of my topics from now on!

    now we wait for his tantrum and still no proof it's as easy he says it is and without any actual help...

    post over! sorry i even started the post.. helpers my a$$ - with the exception of nightwalker83 who actually did attempt. - OFFICIAL REQUEST that someone lock or delete this topic.. pointless at this point.

    @nightwalker83
    i won't PM you anymore since you complained about it - but i thank you for attempting to try to help..tho it was buggy - i still thank you for trying unlike unmentioned names... but you did try, i can respect that.
    since the genius is so rude and impolite to delete entire postings just quoted it

  5. #45

    Thread Starter
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: Save to database.. Please help

    again, as mentioned in post #42.. i don't care about editing/deleting my posts..

    funny how you typed all that instead of actually helping.. meaning opening my app and working on it and then explaining.. that was too hard for you i guess.. yer the type to assume by looking at pictures will give you the full insight on how the program should be coded or how i should do things.. you really wanna help someone out? open their project and look at it and then go from there..


    again, i'm done with you and this post!

  6. #46
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Save to database.. Please help

    Quote Originally Posted by elRuffsta View Post
    funny how you typed all that instead of actually helping.. meaning opening my app and working on it and then explaining.. that was too hard for you i guess..
    This is the type of stuff that SHOULD be discussed via private message!

    I understand you are now trying to figure out how the system where you click a button on the main form know how to refer to a particular item once that item is in the system? That is going by what you said in post #34, I will try to figure this out.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  7. #47
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Save to database.. Please help

    Hard to believe this thread is still going, 8 days, 46 posts for something that should have been possible in less than one hour given the code in the first post and the question at hand as to how to save 5 fields to a database.

    There are several ways to do it, all of which are easy and with a little effort could be done in less than an hour with no previous experience in DB access. I haven't read all the posts, perhaps the question has changed but it really seems more like the OP wants someone to do it for him rather than spend an hour or two figuring out how to do it.

    From the OP
    Code:
    rs.AddNew
    rs("Game Name") = Text1
    rs("Company") = Text2
    rs("Year") = Text3
    rs("Cartridge ID") = Text4
    rs("Rarity") = Combo1.Text
    rs("Own") = Text5
    rs("Qty") = Text6
    rs("Notes") = Text7
    rs("Value") = Text8
    rs("Label") = Text9
    rs.Update
    All that needs to be done is change the values in "s to the actual field names in the database in question, remove a few of those lines since you only wanted to save 5 fields and change the textx references to match whatever it is you want to save. Of course this should have been obvious just by looking at the code, Surely should not take a week to figure out.

    Other than that all that is needed is to have the reference to DAO added to the project and make sure the line that opens the DB and table are pointed to the correct DB and table.

    Of course it would be better to use ADO but that also is very simple to do such a simple thing in.

  8. #48
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Save to database.. Please help

    Version 3

    Fixed up the association between the buttons on the main for an the records.
    Added the code to reset the database.
    Fixed the saving to and loading form the database.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  9. #49

    Thread Starter
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: Save to database.. Please help

    after creating a record.. still calls the first entry made when looking at the entries..

    i created a couple.. but when i go to click on them, still brings up the info on the first one made in other words instead of their own records. we can get rid of the quantities in the database, add form and entry form as mentioned - it's made for 1 seed per button.. i was planning differently, but IkkeEnGij made a big stink about the app - so i decided to go back to it's original intent.. 1 seed per button
    Last edited by elRuffsta; Sep 21st, 2014 at 11:37 PM.

  10. #50
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: Save to database.. Please help

    Quote Originally Posted by elRuffsta View Post
    after creating a record.. still calls the first entry made when looking at the entries..

    i created a couple.. but when i go to click on them, still brings up the info on the first one made in other words instead of their own records. we can get rid of the quantities in the database, add form and entry form as mentioned - it's made for 1 seed per button.. i was planning differently, but IkkeEnGij made a big stink about the app - so i decided to go back to it's original intent.. 1 seed per button
    Can't believe the attitude and the tone you're using here - how you command
    others around (who apparently didn't have enough of your antics yet).

    When one reads stuff like:
    "We can get rid of the quantities..."
    "...i was planning differently..."
    "...i decided to go back to it's original intent..."

    ...it indeed sounds like you really believe, that you're actually *doing-something*.

    But you are Not! (...aside from "bossing others around"...)

    WTH - this forum is thought for *developers* (asking for help from other developers) -
    not for "guys with a manager-attitude", who don't even try to learn the basics
    of programming, to begin to start implementing some simple things on their own.

    There's sites like "Rent a Coder" where you might get your software-product-idea
    of a "One seed per Tray-Slot, one Tray only"-DB-App realized finally.

    Olaf
    Last edited by Schmidt; Sep 22nd, 2014 at 06:28 AM.

  11. #51

    Thread Starter
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: Save to database.. Please help

    @ Schmidt

    i'm not ordering anyone around.. you have some nerve to even think or say that! i just mentioning it to nightwalker83 - i can easily remove it myself, was trying to make it easier when calling back the entry info. and yes, i did do something, i designed the whole app! nightwalker83 is just being nice and helpful trying to get it to work with the DB, but other than that i am doing the rest thank you very much!

  12. #52
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Save to database.. Please help

    Have a look at attachment posted by MarkT in post#36 here.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  13. #53

    Thread Starter
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: Save to database.. Please help

    nice! so far it looks like it works the way it was intended.. thank you and thank you to MarkT.. i just have 1 question tho, just to clear things.. why is there an ID and TrayPosition in the DB? i'm just trying to make sense of it.. because wouldn't they both be the same?

    like id says 3 but tray position says 32.. wouldn't it be 32 for both since that's the slot i clicked on when adding a seed? just curious

    i get it was the 3rd entry made... but what relevance does that make when only trayposition is what matters - is it to help collect the data for that specific seed?
    Last edited by elRuffsta; Sep 26th, 2014 at 12:54 AM.

  14. #54
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Save to database.. Please help

    Quote Originally Posted by elRuffsta View Post
    nice! so far it looks like it works the way it was intended.. thank you and thank you to MarkT.. i just have 1 question tho, just to clear things.. why is there an ID and TrayPosition in the DB? i'm just trying to make sense of it.. because wouldn't they both be the same?
    No, the ID would be the button ID whereas TrayPosition would hold the Record ID. The Record ID is going to be 1 less than the button index because the record set start at -1 where as the button index start at 0.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  15. #55

    Thread Starter
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: Save to database.. Please help

    i did notice one thing tho.. if i select anything other than "Hot" or "Mild" - it won't save it to the db as such.. saves as mild

    i also tweaked the app, but i did not touch the coding that saves to the db.. the error already pre-existed

    working seed tray

  16. #56
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Save to database.. Please help

    In the addRecord sub you have to check which option button is selected and then save the value.
    Code:
    Private Sub addRecord()
    Dim cn As ADODB.Connection
    Dim sql As String
    Dim i As Integer
    
        For i = 0 To Option1.UBound
            If Option1(i).Value Then
                Exit For
            End If
        Next i
        
        sql = "Insert Into Table1(TrayPosition,Name,[Date],Spice,[Plant Type]) " & _
            "Values([TRAYPOSITION],'[NAME]','[DATE]','[SPICE]','[PLANTTYPE]')"
            
        sql = Replace(sql, "[TRAYPOSITION]", intBtnIndex)
        sql = Replace(sql, "[NAME]", Text1.Text)                  'Saves the Seed name to the database
        sql = Replace(sql, "[DATE]", Text3.Text)                  'The date the seed was planted
        sql = Replace(sql, "[SPICE]", Option1(i).Caption)     'The how hot the seed is
        sql = Replace(sql, "[PLANTTYPE]", Combo1.Text)            'The type of seed (example: vegtable)
        
        On Error GoTo HandleSaveErrors
        
        Set cn = GetConnection
        cn.Execute sql
        
        Set cn = Nothing
        
        blnAdded = True
    
    Exit Sub
    HandleSaveErrors:
        strMessage = "Record could not be saved. " & vbCrLf & Err.Description
                                
        MsgBox strMessage, vbExclamation, "Database Error"
    End Sub
    In reality, it would be much better to save the option button index instead of the caption. If you save the index you wouldn't need a Case statement to select the saved option button when you call FillFields in your Entry form. All you would need to do is
    Code:
    Option2(rs!Spice).Value = True
    If you run with this approach you need to change the Spice column in the table from Text datatype to Number and adjust the insert query so Spice is not wrapped in single quotes.
    Last edited by MarkT; Sep 26th, 2014 at 08:56 AM.

  17. #57
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Save to database.. Please help

    Quote Originally Posted by Nightwalker83 View Post
    No, the ID would be the button ID whereas TrayPosition would hold the Record ID. The Record ID is going to be 1 less than the button index because the record set start at -1 where as the button index start at 0.
    You have that backwards.
    Id = the id of the record
    TrayPosition = the index of the button that stores the details

    In databases, Ids (primary key) should be unique auto generated values. The application should have nothing to do with the management of them. Ids become important when doing CRUD operations.

    In simplest terms, the changes I made were to save the id (record id) in the tag property of the button when loading the tray. This way you always know which record to work on. The I added TrayPosition so you know where to place the seed in the tray when you loading the data.

  18. #58

    Thread Starter
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: Save to database.. Please help

    In reality, it would be much better to save the option button index instead of the caption. If you save the index you wouldn't need a Case statement to select the saved option button when you call FillFields in your Entry form. All you would need to do is
    Code:

    Code:
    Option2(rs!Spice).Value = True
    If you run with this approach you need to change the Spice column in the table from Text datatype to Number and adjust the insert query so Spice is not wrapped in single quotes.
    i did exactly as you said, however i get the following highlighted in yellow after i run the app and go to "entry" form
    Code:
    Option2(rs!Spice).Value = True

  19. #59
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Save to database.. Please help

    Quote Originally Posted by elRuffsta View Post
    i did exactly as you said, however i get the following highlighted in yellow after i run the app and go to "entry" form
    Code:
    Option2(rs!Spice).Value = True
    By exactly does that mean you updated the database Spice Column datatype also?
    Quote Originally Posted by MarkT View Post
    If you run with this approach you need to change the Spice column in the table from Text datatype to Number and adjust the insert query so Spice is not wrapped in single quotes.
    When you get an error I helps a lot if you say what the error is instead of just I got an error on this line. Do you ever take your car in for repairs and just tell them it isn't working correctly? It's all in the details.

  20. #60
    Frenzied Member
    Join Date
    Jun 2014
    Posts
    1,084

    Re: Save to database.. Please help

    Quote Originally Posted by MarkT View Post
    In databases, Ids (primary key) should be unique auto generated values
    MarkT,
    would it be ok with you, if i open a new topic in the database section, asking for comments on that statement ?
    and would it be ok, if i quote you there ?

  21. #61
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Save to database.. Please help

    That's fine with me.

  22. #62
    Frenzied Member
    Join Date
    Jun 2014
    Posts
    1,084

    Re: Save to database.. Please help

    Mark, Thanks, Done

  23. #63
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Save to database.. Please help

    elRuffsta,

    Have you "Resolved" the problem?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  24. #64

    Thread Starter
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: Save to database.. Please help

    not really.. when it is - i will mark it as so

  25. #65
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Save to database.. Please help

    Quote Originally Posted by elRuffsta View Post
    not really.. when it is - i will mark it as so
    Are you still working on this question from post #55 or have you found a solution?

    Quote Originally Posted by elRuffsta View Post
    i did notice one thing tho.. if i select anything other than "Hot" or "Mild" - it won't save it to the db as such.. saves as mild

    i also tweaked the app, but i did not touch the coding that saves to the db.. the error already pre-existed
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  26. #66

    Thread Starter
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: Save to database.. Please help

    haven't found a solution as of yet.. also trying to make the "Save changes" button and textbox to work..

    like i said, i tweaked it up a little.. Seed Tray

  27. #67
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Save to database.. Please help

    Did the solution in post #56 not solve the above problem?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Page 2 of 2 FirstFirst 12

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