Results 1 to 16 of 16

Thread: visual basic 6, ms access, adodc

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2017
    Posts
    18

    Unhappy visual basic 6, ms access, adodc

    where to store image filename path via visual basic 6 in a DB table? so that when i click update command on a form, students datails and picture filename along with extension will gets store in a access database and display record that i've entered

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: visual basic 6, ms access, adodc

    If you store the file's path/filename, it doesn't matter what table/field you use because you are only storing a string. However, 2 potential problems.

    1. If the VB app is ever moved to a different computer or the picture's path/filename changes, or the picture is deleted from the disk, then you have no picture any longer

    2. If the table's field length is 255, that may not be large enough to hold the complete file/path name

    A better solution may be to store the picture itself in the database instead of the path/filename. In the Datbase section of the forum, open the FAQ page and search for these key words: pictures Access. There are examples there.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: visual basic 6, ms access, adodc

    If the pictures are stored outside of the database in some folder than you probably don't need that folder path recorded for each one. In that case a TEXT(255) field should be plenty unless you are capturing pictures and storing them as "Unicode" file names, usually fruitlessly wasteful anyway.

    Lots of agony over Unicode can be avoided simply by sticking to the 7-bit ASCII character subset for things like this. Such file names ought to be internal anyway, your program has to generate them or at least ensure they are unique, so you have full control. No need for funky accented Roman letters or non-Roman alphabets. Your database should have the person's name (which might not even be unique) with a mapping to a unique image file name which could be a number or a hash of the name and a timestamp of the creation time or something.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2017
    Posts
    18

    Re: visual basic 6, ms access, adodc

    thank very much for your reply
    BUT can you help me a bit with coding, because i have heard that we can link the pictures from picturebox to maccess

  5. #5
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: visual basic 6, ms access, adodc

    "Linking" only in a very casual sense.

    You store a file name as a String value. Your program has to do any "linking" since the database only knows about the String values. You have to store the files and retrieve the files as pictures.

    No clue where MSAccess comes in. Are you using VB6 or Access?

    Don't confuse yourself by talking about "Access databses." These are Jet databases, though if MS Access touches them it dumps a ton of private structures into them since it uses them to hold cruft such as its forms and macro code.

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

    Re: visual basic 6, ms access, adodc

    Back in the day when I was first learning to use Access as a backend I created a little app that used pictures which would be stored in an Access 97 database.
    All I had to do was bind the db field to a picture box on the form. This was in VB5 using the DAO data control

    I have no idea if that is still supported with ADO and/or new versions of MSAccess or not but it was very simple back when I gave it a try.
    The picture box auto loaded the images as the record pointer changed and if memory serves you could use load picture to add a picture to the picture box then when updating the record that picture would be saved to the db.

    It has been a long time but I am pretty sure that is all there was to it. I know I only spent about 10 minutes on it

  7. #7
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: visual basic 6, ms access, adodc

    That still works and you can do without data binding too.

    It often isn't the first choice except for databases that will never get large. Images take a lot of space and you can run into the limits of .MDB and even .ACCDB files fairly fast. It doesn't help that a lot of people end up storing bulky BMP images instead of compressing to GIF or JPEG (or even PNG with a little care though that is usually off the table for bound controls).

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Mar 2017
    Posts
    18

    Re: visual basic 6, ms access, adodc

    Means after updating on a form
    When I'll open msaccess, then database that I've created from Add in using Vb6, then straight after that I'll double click and open the table , so i wanna see all those information that I've stored in the database using form.
    Though I can already see some of the details , but couldn't find picture name like logo.jpg I want it see picture name with extension there too, followed by name, address and so on.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Mar 2017
    Posts
    18

    Question Save/load images in a Picturebox using standard code

    can anyone help me how to display picture name with extension in a access database table
    eg logo.jpg (link to a image that locate on folder ) from picture box or from a database table

  10. #10
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Save/load images in a Picturebox using standard code

    1. Do you know the full path of the picture file?
    2. Do you know how to insert data into a table?

    There are others ways of doing this as well, but it is pretty simple. If you answered yes to #'s 1 and 2, you can simply insert the full path name (along with the file name) into a table. If all pictures are located in the same folder, you don't need to do that, just append the path to the filename when you retrieve it from the db.

  11. #11
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Save/load images in a Picturebox using standard code

    oops! I just noticed you posted the same question earlier...don't start a new thread...just get your question answered on the other one....

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Mar 2017
    Posts
    18

    Re: Save/load images in a Picturebox using standard code

    how to append the path to file name

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Mar 2017
    Posts
    18

    Re: Save/load images in a Picturebox using standard code

    sorry if am troubling you but somehow i am trying to understand it in a simple way. Since i am a new in vb6 i dont have much idea about this topic

  14. #14
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Save/load images in a Picturebox using standard code

    string concatenation

    let's say the folder is located in "C:\Users\siddhanth\AppData\pictures"
    You may want to put that in a variable, like "myAppPathForPictures"

    ex: Dim myAppPathForPictures as string
    myAppPathForPictures = "C:\Users\siddhanth\AppData\pictures\"

    and your picture filename is logo.jpg

    Then for the full path, could be: myAppPathForPictures & "logo.jpg"
    Last edited by SamOscarBrown; Apr 10th, 2017 at 09:41 AM. Reason: forgot quotes around logo.jpg

  15. #15
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,102

    Re: visual basic 6, ms access, adodc

    Merged the two threads together. The OP didn't really start this second thread, it was attached to a different thread and I split it out into a new thread without realizing that it really belonged to this thread.
    My usual boring signature: Nothing

  16. #16

    Thread Starter
    Junior Member
    Join Date
    Mar 2017
    Posts
    18

    Re: Save/load images in a Picturebox using standard code

    thanks SamOscarBrown for help i've tried your example just now, but still nt getting the desire result

Tags for this Thread

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