| | |
saving image in ms access using vb6
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Oct 2009
Posts: 14
Reputation:
Solved Threads: 0
hello everybody,
im venkat doing my b.e 3rd year... Im currently working on my project of college administration system using vb6.
I need help on how to save an image in the access database...i have got the code on how to browse an image. but i'm not able to find out how to save it to a particular record on a database.
So please help me in this,,thanx in advance[/B]
im venkat doing my b.e 3rd year... Im currently working on my project of college administration system using vb6.
I need help on how to save an image in the access database...i have got the code on how to browse an image. but i'm not able to find out how to save it to a particular record on a database.
So please help me in this,,thanx in advance[/B]
•
•
Join Date: May 2009
Posts: 372
Reputation:
Solved Threads: 26
0
#2 Nov 9th, 2009
Do you want to save the file name or the image?
Your question is unclear for the purpose of your request.
If you want to have the image to show in the form, you can only do it from a file so LoadPicture() the image to the form preferable to a frame or other picture object to store the image.
Your question is unclear for the purpose of your request.
If you want to have the image to show in the form, you can only do it from a file so LoadPicture() the image to the form preferable to a frame or other picture object to store the image.
If ALL my answers are wrong, only then will I read the question
•
•
Join Date: Oct 2009
Posts: 14
Reputation:
Solved Threads: 0
0
#3 Nov 9th, 2009
i need to save the image file...that is, if i register a new name i'll be having a option for photo uploading in the same form itself,,,,i need to save that photo by browsing the computers folders just like how we upload files, and after choosing a image file i need to save it to the particular record itself,,,im not talking about the name of the image but im talking about saving the image itself, So if we search for that name i'l be getting all his details including a photo....i hope u understand,,,
•
•
Join Date: May 2009
Posts: 372
Reputation:
Solved Threads: 26
0
#4 Nov 9th, 2009
You mean you want to load the picture into the form?
LoadPicture will do this but like I say, VB6 only accepts *.bmp, *.gif, *.jpg but not other formats. It might accepts *.tif images but am not sure.
Still not sure about what you say. Saving is not the correct term to use. You either load the picture into a userform or you add the filename to the record for referencing.
Perhaps you want to copy the image file into your own folder?
You cannot put a file into a record. A record is just a data file that lists your data.
LoadPicture will do this but like I say, VB6 only accepts *.bmp, *.gif, *.jpg but not other formats. It might accepts *.tif images but am not sure.
Still not sure about what you say. Saving is not the correct term to use. You either load the picture into a userform or you add the filename to the record for referencing.
Perhaps you want to copy the image file into your own folder?
You cannot put a file into a record. A record is just a data file that lists your data.
If ALL my answers are wrong, only then will I read the question
•
•
Join Date: Dec 2006
Posts: 4
Reputation:
Solved Threads: 1
0
#5 Nov 9th, 2009
There is a means to store the image, but I have never attempted that.
You could end up with a rather large DB.
Why not create a sub folder in the same location as the DB.
Then have sub folders for each ID (Student ID ?)
Place the image in there.
Your program can retrieve the image any time in the future, as the program knows where to find the folder, and it knows the Student ID to locate that Student's sub folder.
You could end up with a rather large DB.
Why not create a sub folder in the same location as the DB.
Then have sub folders for each ID (Student ID ?)
Place the image in there.
Your program can retrieve the image any time in the future, as the program knows where to find the folder, and it knows the Student ID to locate that Student's sub folder.
•
•
Join Date: May 2009
Posts: 372
Reputation:
Solved Threads: 26
0
#6 Nov 9th, 2009
RobCr - thanks for your input. I actually hate Access but know a bit about VB6.
venkatnams - RobCr says it can be done but it may bloat your database. I suggest if it is for student ID cards, to put the images into a sub folder then "Call each image as you need it into a form. Add Stuednt details to the form then print the ID Card (if this is the purpose of the project).
venkatnams - RobCr says it can be done but it may bloat your database. I suggest if it is for student ID cards, to put the images into a sub folder then "Call each image as you need it into a form. Add Stuednt details to the form then print the ID Card (if this is the purpose of the project).
If ALL my answers are wrong, only then will I read the question
•
•
Join Date: May 2009
Posts: 372
Reputation:
Solved Threads: 26
0
#8 Nov 10th, 2009
Chambutton.ocx? I've never heard of that. Did you create it yourself?
Data1.Recordset.AddNew - What does Data1 refer to?
Are you trying to access an Accesss database from outside of Access?
Access has it's own userform facility where you can access the database. I think you need an Sql event to open the database. I also think that if the user does not actually have Acess on the computer, accessing the mdb file will be hard to do as I believe that you can only acceess the file if the user has the software that created the file in the first place. Unless you are savvy to extracting data from a file, this is a hard task project.
Data1.Recordset.AddNew - What does Data1 refer to?
Are you trying to access an Accesss database from outside of Access?
Access has it's own userform facility where you can access the database. I think you need an Sql event to open the database. I also think that if the user does not actually have Acess on the computer, accessing the mdb file will be hard to do as I believe that you can only acceess the file if the user has the software that created the file in the first place. Unless you are savvy to extracting data from a file, this is a hard task project.
If ALL my answers are wrong, only then will I read the question
•
•
Join Date: Oct 2009
Posts: 14
Reputation:
Solved Threads: 0
0
#9 Nov 10th, 2009
thanx for the file...i ran it,,it worked fine...but my aim is not only to view...i need to save it in access against a particular id,,,
please check the following link::
http://s924.photobucket.com/albums/a...nt=project.jpg
i hope you understand the scenario now,,
waiting for ur response,,
thank you
please check the following link::
http://s924.photobucket.com/albums/a...nt=project.jpg
i hope you understand the scenario now,,
waiting for ur response,,
thank you
1
#10 Nov 10th, 2009
try the following code, make changes as desired
vb Syntax (Toggle Plain Text)
Dim CN As New ADODB.Connection Dim RS As ADODB.Recordset Dim DataFile As Integer, Fl As Long, Chunks As Integer Dim Fragment As Integer, Chunk() As Byte, i As Integer, FileName As String Private Const ChunkSize As Integer = 16384 Private Const conChunkSize = 100 Private Sub cmdSave_Click() CN.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Pubs;Data Source=Test" Dim strSQL As String strSQL = "SELECT * FROM pub_info where pub_id = '9999'" RS.Open strSQL, CN, adOpenForwardOnly, adLockOptimistic RS.AddNew SavePicture RS.Update Set RS = Nothing Set RS = New Recordset End Sub Private Sub SavePicture() Dim strFileNm As String DataFile = 1 Open strFileNm For Binary Access Read As DataFile Fl = LOF(DataFile) ' Length of data in file If Fl = 0 Then Close DataFile: Exit Sub Chunks = Fl \ ChunkSize Fragment = Fl Mod ChunkSize ReDim Chunk(Fragment) Get DataFile, , Chunk() RS!logo.AppendChunk Chunk() ReDim Chunk(ChunkSize) For i = 1 To Chunks Get DataFile, , Chunk() RS!logo.AppendChunk Chunk() Next i Close DataFile End Sub
Share your Knowledge.
![]() |
Similar Threads
- saving pictures to Access using ADO (VB.NET)
- retrieve image from access db to picturebox (C#)
- How to Store Image in Oracle 9i using VB6 (Visual Basic 4 / 5 / 6)
- How can i access data from MS Access using VB6 (I need the connection code) (Visual Basic 4 / 5 / 6)
- VB6 and MS Access Problem (Visual Basic 4 / 5 / 6)
- Update user-level security (MS Access) in VB6 (Visual Basic 4 / 5 / 6)
- create a query in access from vb6 (Visual Basic 4 / 5 / 6)
- How to set user rights in ms.access from vb6 (Visual Basic 4 / 5 / 6)
- New key word not recoginized in VB6 connecting to Access (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Open a form in a new window?
- Next Thread: VB6 Form Refresh help Request
Views: 1084 | Replies: 16
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






