Results 1 to 13 of 13

Thread: GetDate, DeleteData

  1. #1

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    First of all, a couple of questions. Does your table have a key? If it does, is the key data shown in the grid? If it is, then deleting the row is easy with code like this from one of my programs:
    Code:
    SQL = "DELETE FROM SavedSystems WHERE SystemName = " & "'" & sSysName & "'"
                    gdbRWTU.Execute SQL, dbFailOnError
    . You would have to change it to match your database and table of course, and substitute the data in the grid that represents the table's key for sSysName.

    Another question is why do you display the text? Why not delete the data depending on a row in the grid that the user clicks?

    Finally, there is a small problem in your code to display the text. You wind up with "--" at the beginning of the string. One way to avoid that would be to modify your loop like this.
    Code:
    For intI = 0 To MSFlexGrid1.Cols - 1
        MSFlexGrid1.Col = intI
        If intI > 0 Then
            strTemp = strTemp & "--" & MSFlexGrid1.Text
        Else
            strTemp = MSFlexGrid1.Text
        End If
    Next intI
    ------------------
    Marty
    COGITO EGGO SUM
    I think; therefore I am a waffle.

  2. #2
    Member
    Join Date
    Jan 2000
    Posts
    34

    Post

    Currently the table DOES NOT have a primary key value. I've thought about adding a key as an autonumber, but how would that work if multiple users are accessing the database? I used the "--" to separate the column values..Also, I wanted frmQuery(form2) to display the info from the selected row so the user could edit, delete, "checkout" or check off that particular "todo" for the day. Any suggestions as to a primary key value, or would the autonumber work as a key? Thanks.

  3. #3

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    Let me suggest that you buy a book titled Doing Objects in Microsoft Visual Basic 5.0 by Deborah Kurata. It is one of the best books I've read. I think it would be particularly appropriate for you, because she has the reader build and improve a Todo List application in the various chapters of the book.

    ------------------
    Marty
    COGITO EGGO SUM
    I think; therefore I am a waffle.

  4. #4
    Member
    Join Date
    Jan 2000
    Posts
    34

    Post

    Thank you for the book suggestions, but what about now?

  5. #5

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    I'm not an expert in multiuser database apps so I can't give you much advice on that subject. I know however that you will need to develop a locking scheme if more than one user will be accessing the same todo table. But my main point is that todo programs have been done many times by better programmers than you or I, so why reinvent the wheel?

    ------------------
    Marty
    COGITO EGGO SUM
    I think; therefore I am a waffle.

  6. #6
    Member
    Join Date
    Jan 2000
    Posts
    34

    Post

    Hi All,

    Here's the code on frmSplash(form1):

    Dim intI As Integer, strTemp As String

    For intI = 0 To MSFlexGrid1.Cols - 1
    MSFlexGrid1.Col = intI
    strTemp = strTemp & "--" & MSFlexGrid1.Text

    Next intI

    frmViewRow.txtViewRow = strTemp

    Okay, now frmQuery(form2) view the entire string of strTemp into txtViewRow. I want the user to be able to delete the row in the database, but I'm not sure how to go about doing this? Is there a way to pull the data as variables and then I can plug them into my query? Any suggestions? I said date in the subject, I meant data...

    Thanks,
    Dave

    [This message has been edited by mecca (edited 01-31-2000).]

    [This message has been edited by mecca (edited 01-31-2000).]

  7. #7
    Member
    Join Date
    Jan 2000
    Posts
    34

    Post

    That's a stupid gesture. How do you think I will learn better programming skills if I don't pick up an idea and run with it? Thanks, but no thanks for the help. Try to be more positive on your future posts.

  8. #8

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    I don't know what you mean by a "stupid gesture". One of the only "stupid gestures" I can think of involves the middle finger of your hand, but perhaps you meant "stupid suggestion". In any case I seem to have offended you and that certainly wasn't my intention. While you can definately learn things on your own by trial and error, you can also learn from books.

    ------------------
    Marty
    COGITO EGGO SUM
    I think; therefore I am a waffle.

  9. #9
    Member
    Join Date
    Jan 2000
    Posts
    34

    Post

    The mere "act" of you implying that I re-invent the wheel is a "stupid gesture." Now rethink the statement and try, if you can, understand exactly what I meant by "stupid gesture."

  10. #10
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Originally posted by mecca:
    The mere "act" of you implying that I re-invent the wheel is a "stupid gesture." Now rethink the statement and try, if you can, understand exactly what I meant by "stupid gesture."
    First of all, Marty's not implying anything, he asked a you question.
    Secondly, he's advising you to _not_ re-invent the wheel by his wording.
    Lastly, you'll find people will be more likely to answer your questions if you don't punish them for doing so.


  11. #11
    Member
    Join Date
    Jan 2000
    Posts
    34

    Post

    Both of you are taking this out of porportion. MartinLiss began helping me and then suggested that I read a book. That's fine, but maybe I needed a little help now so I wouldn't have to run out and buy a book just yet. Then MartinLiss proceeded to tell me to re-invent the wheel, that's not helping, go figure. Further, JHausmann, why is this your business anyway? If you'll read all my prior posts, I'm always friendly and thankful for any help I get, so why has this particular post turned sour w/o pointing the finger at me?

  12. #12
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Marty and I are co-workers, separated by a wall. The book Marty suggested will teach you OOP and VB, as well as provide you with all the source code you'll need to do a "todo" project. If you read Marty's post you'll see that he's suggesting you use _that_ code so that _you_ don't have to re-invent the wheel.

    It is easy to interpret your post "That's a stupid gesture" to be "That was a stupid answer" which is far from friendly or thankful. That's also the point the thread degenerated into a free-for-all.

  13. #13
    Member
    Join Date
    Jan 2000
    Posts
    34

    Post

    Great then, we're all on the same page. End of story, let's move on. I'll certainly take Marty's book suggestion into consideration. Thanks.

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