i need to save an image to my project using Visual Basic as my Front End and MS Access as my Back End....


i am working on a Student Detail and i need to attach Student picture on each record..

my problem is saving the image....

i already have the code for uploading it

Hi,
You said the code is already uploaded. But i cant see the code.

There are two ways in which you can save the image in youe access database.
1) the simplest way is to store the path of the image.
2) you need to use FileScriptingObjects method to find whether the image is actually stored anywhere in your hard disk or not. If yes, then use file handling methods to convert the image to long binary and save it in your database. To open the image once again you need to convert it to the actual image and then display.

for any further assistance feel free to mail:
[snipped]

to do i link a command button to a Report in microsoft Access to enable viewing of my Sorted report

Hey guys this is my exact code.... i am using ADODC as my Connection for my database...
please help

Dim filen As String


Function DT()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
Text13.Enabled = False
Text14.Enabled = False
Text15.Enabled = False
Text16.Enabled = False
Text17.Enabled = False
Text18.Enabled = False
Text19.Enabled = False
Text20.Enabled = False
Text21.Enabled = False
Text22.Enabled = False
Text23.Enabled = False
Text24.Enabled = False
Text25.Enabled = False
Text26.Enabled = False
Text27.Enabled = False
Text28.Enabled = False
Text29.Enabled = False
Text30.Enabled = False
Text31.Enabled = False
Text32.Enabled = False
Text33.Enabled = False
Text34.Enabled = False
Text35.Enabled = False
Text36.Enabled = False
Text37.Enabled = False
Text38.Enabled = False
Text39.Enabled = False
Text40.Enabled = False
Text41.Enabled = False
Text42.Enabled = False
Text43.Enabled = False
Text44.Enabled = False
Text45.Enabled = False
Text46.Enabled = False
Text47.Enabled = False
Text48.Enabled = False
Text49.Enabled = False
Text50.Enabled = False
Text51.Enabled = False
Text52.Enabled = False
Text53.Enabled = False
Text54.Enabled = False
Text55.Enabled = False
Text56.Enabled = False
Text57.Enabled = False
Text58.Enabled = False
Text59.Enabled = False
Text60.Enabled = False
Text61.Enabled = False
Text62.Enabled = False
Text63.Enabled = False
Text64.Enabled = False
Text65.Enabled = False
End Function

Function ET()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Text10.Enabled = True
Text11.Enabled = True
Text12.Enabled = True
Text13.Enabled = True
Text14.Enabled = True
Text15.Enabled = True
Text16.Enabled = True
Text17.Enabled = True
Text18.Enabled = True
Text19.Enabled = True
Text20.Enabled = True
Text21.Enabled = True
Text22.Enabled = True
Text23.Enabled = True
Text24.Enabled = True
Text25.Enabled = True
Text26.Enabled = True
Text27.Enabled = True
Text28.Enabled = True
Text29.Enabled = True
Text30.Enabled = True
Text31.Enabled = True
Text32.Enabled = True
Text33.Enabled = True
Text34.Enabled = True
Text35.Enabled = True
Text36.Enabled = True
Text37.Enabled = True
Text38.Enabled = True
Text39.Enabled = True
Text40.Enabled = True
Text41.Enabled = True
Text42.Enabled = True
Text43.Enabled = True
Text44.Enabled = True
Text45.Enabled = True
Text46.Enabled = True
Text47.Enabled = True
Text48.Enabled = True
Text49.Enabled = True
Text50.Enabled = True
Text51.Enabled = True
Text52.Enabled = True
Text53.Enabled = True
Text54.Enabled = True
Text55.Enabled = True
Text56.Enabled = True
Text57.Enabled = True
Text58.Enabled = True
Text59.Enabled = True
Text60.Enabled = True
Text61.Enabled = True
Text62.Enabled = True
Text63.Enabled = True
Text64.Enabled = True
Text65.Enabled = True

End Function
Function CT()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
Text21.Text = ""
Text22.Text = ""
Text23.Text = ""
Text24.Text = ""
Text25.Text = ""
Text26.Text = ""
Text27.Text = ""
Text28.Text = ""
Text29.Text = ""
Text30.Text = ""
Text31.Text = ""
Text32.Text = ""
Text33.Text = ""
Text34.Text = ""
Text35.Text = ""
Text36.Text = ""
Text37.Text = ""
Text38.Text = ""
Text39.Text = ""
Text40.Text = ""
Text41.Text = ""
Text42.Text = ""
Text43.Text = ""
Text44.Text = ""
Text45.Text = ""
Text46.Text = ""
Text47.Text = ""
Text48.Text = ""
Text49.Text = ""
Text50.Text = ""
Text51.Text = ""
Text52.Text = ""
Text53.Text = ""
Text54.Text = ""
Text55.Text = ""
Text56.Text = ""
Text57.Text = ""
Text58.Text = ""
Text59.Text = ""
Text60.Text = ""
Text61.Text = ""
Text62.Text = ""
Text63.Text = ""
Text64.Text = ""
Text65.Text = ""
End Function

Private Sub Command1_Click()
MsgBox "                 Ayaw mo na?              "
End
End Sub

Private Sub Command10_Click()
CommonDialog1.Filter = "Pictures (*.bmp;*.jpg)|*.bmp;*jpg|"
CommonDialog1.ShowOpen
filen = CommonDialog1.FileName
Picture1.Picture = LoadPicture(filen)
End Sub

Private Sub Command2_Click()
MsgBox "Mag-aadd ka? add mo din ako huh.. ^_^"
Call ET
Call CT
Adodc1.Refresh
Adodc1.Recordset.AddNew
Command3.Enabled = True
Command2.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command10.Enabled = True
Text1.SetFocus
End Sub


Private Sub Command3_Click()
Call DT
Adodc1.Recordset.Update
Adodc1.Recordset.Save
Command2.Enabled = True
Command3.Enabled = False
Command4.Enabled = True
Command5.Enabled = True
Command10.Enabled = False
MsgBox "      Saved"
End Sub

Private Sub Command4_Click()
Call ET
Command3.Enabled = True
Command2.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command10.Enabled = True
Text1.SetFocus
End Sub

Private Sub Command5_Click()
MsgBox "You will now delete the record."
Adodc1.Recordset.Delete
End Sub



Private Sub Command6_Click()
Adodc1.Recordset.MoveFirst
End Sub

Private Sub Command7_Click()
Adodc1.Recordset.MovePrevious
End Sub

Private Sub Command8_Click()
Adodc1.Recordset.MoveNext
End Sub

Private Sub Command9_Click()
Adodc1.Recordset.MoveLast
End Sub

In which line you are assigning data from controls to ado control ?

i am using ADODC connection which is already assigned in my project as its components...

please help.....

Command3 is my save button....

How you assign the image, is is converted into binary before assigning ?

thank you for you help..... they are very useful tnx...

i am unable to save photo using vb6 and access at backend. can anybody can provide me the codes. plz help

Load the picture to the picturebox. Then add it as usual to the Binary field as you do with text fields.
That will like it.

RecordSet.AddNew
Recordset.Fields("YourFieldName")=PicBox.Image
Recordset.Update
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.