Results 1 to 2 of 2

Thread: Adding/Searching database

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    1

    Post

    Hello All:
    Having a little coding problem with VB6 ProEdition. I'm trying to be able to add records and search record's within the database. Problem of course getting tons of error messages. I'm running Adodc, and running a data environment also. The database loads and I can scroll through the data but not add and search it. Thanx for any help.!?
    I'm adding the some of the code for the add/search.

    Private Sub Command1_Click()
    prompt$ = "To Enter a New Record click OK"
    reply = MsgBox(prompt$, vbOKCancel, "Add New Record")
    If reply = vbOK Then ' If the user clicks OK
    txtText1.SetFocus 'move cursor to Text1 box
    DataEnvironment1.rsCommand1.Recordset.AddNew ' and get new record
    End If
    End Sub

    Private Sub Command2_Click()
    prompt$ = "Enter the Trouble Ticket Number to start serch"
    'get string to be used in the Trouble Ticket field serch
    SearchStr$ = InputBox(prompt$, "Ticket Search")
    DataEnvironment1.rsCommand1.Index = "Trouble Ticket" 'use Trouble Ticket
    DataEnvironment1.rsCommand1.Seek "=", SearchStr$ 'and search
    If DataEnvironment1.rsCommand1.NoMatch Then 'if no match
    DataEnvironment1.rsCommand1.Recordset.MoveFirst 'go to first record
    End If
    End Sub

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    usually an SQL statement is used to do searches
    there is an example using the ADODC at:

    http://pages.about.com/vbmakai/ado4.htm




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