Results 1 to 4 of 4

Thread: Writing to database

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    20
    I have an access97 db attached to my vb 5 program with DAO. When I type a record in it will save the record to the database no matter what. So if the user doesnt complete fields the record is still saved to the database. Does anyone know how to not save the record to the database say if a certain field wasnt filled out?
    So it would abandon the record if certain fields were not completed??
    Thanks

  2. #2
    Addicted Member
    Join Date
    Aug 2000
    Location
    Fremont Ohio 43420
    Posts
    253
    You can put this code inside the button on which you press to put the data in the Access Table.

    private sub cmd????()
    if ucase(trim(txt???)) = "" then
    msgbox "This field needs to be filled out", , "Missing Data"
    txt????.setfocus
    exit sub
    end if

    This code will not allow the user to save until the field is filled out.

    Hope this helps you out!

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    20
    But if i enter information on the form and exit out even if I dont click on save then come back into the program the partial data is still listed in the database

  4. #4
    Lively Member
    Join Date
    Mar 2000
    Location
    Fort Lauderdale, FL USA
    Posts
    112
    Don't use the AddNew method until your user presses a "Submit" button. Then, validate the entries, add a new record and populate the database fields.
    Damonous

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