Modules & VBA :: Insert Picture In SQL Using Button
Oct 4, 2014
I use the botton code for save image in SQL
Dim fDialog As Object
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
Dim varFile As Variant
Set Cn = New ADODB.Connection
Cn.Open "Provider=SQLOLEDB;data Source=.;" & _
[Code] ....
But I have a problem when my database more than 2000 record. I think my problem in
rs.Open "Select * from Table_2", Cn, adOpenKeyset, adLockOptimistic
Have a database that stores information about jewelry. The user wants each record to have a picture of the item. No matter what I try I can’t put a picture field in my table. All help is appreciated. tillessal@yahoo.com :confused:
I want to display a picture (or pictures) from Imagelist in the picturebox (KIBES_picture).But I am getting a type mismatch error in the last line. What am I doing wrong?
Code: Public Sub load_picture() Dim iml As ImageList Set iml = New ImageList iml.ListImages.Add , , LoadPicture("K:Kapa-Planung ElektrikKibes_DatabaseAufbausystemme2_Innenbeleuchtung .00000-0002_Treppebeleuchtung_ueber_2 Schalters_087A00ekran_edycja.jpg") [Forms]![Search]![KIBES_picture].Picture = iml.ListImages(1)
Besides, when I have Listimage(0) I am getting an other error: Index out of bounds. Strange, because the index should start from zero?
I want to my ImageFrame to open as a picture. My problem is that my picture could be either a .jpg or a .png (or whatever). The code below works if I hard code profile_pic.png or profile_pic.jpg. Is there a way to use the wildcard here? (Its not working as written now)
Code:
Dim vFolderPath As String, strFile As String, dirFile As String vFolderPath = DLookup("FolderName", "tblCodes-FolderControl", "FolderKey = '" & "Profile" & "'") dirFile = Dir(vFolderPath & ctrl_people_id & " *", vbDirectory) strFile = "profile_pic." + "*"
I am trying to export an attachment item (Picture .jpg) to a word document. I have been exporting text to a word document successfully with below syntax "
With rst strLandSalesID = Nz(.Fields("LandSalesID")) strPhotograph = Nz(.Fields("Attachments"))
I'm having trouble with a shell() command in my vba.
I'm trying to call up the picture viewer showing the file of the photo I clicked on in a form. Everything is happening as expected - the file opens in Windows Photo Viewer, but it is minimized.
I can open a picture fine from Windows Explorer, but something about my shell command is forcing a minimize.
Here is my code:
Code: Dim sFile As String PicFile = "C:Pics" & Me!PicName & ".jpg" Shell "RunDLL32.exe C:WindowsSystem32Shimgvw.dll,ImageView_Fullscreen " & PicFile
I would have assumed ImageView_Fullscreen would do what I want!
I've been trying to search for all picture files in my documents and copy them to a folder on the desktop. I found this and it work great for searching however I'm having trouble getting the copy to work. [URL] ....
Code: Dim colFiles As New Collection RecursiveDir colFiles, "C:Photos", "*.jpg", True Dim vFile As Variant For Each vFile In colFiles Debug.Print vFile Next vFile
Code:
I replaced the debug.print vfile with my copy function. I've tried copyfile but it needs to specify the destination with the file name. I tried using the FSO filecopy method and can't get it to work (keep getting a compile error "Expected =") I feel the hard part is done and this part should be simple.
i already make this sql for dlookup table for may insert button, all going good, but when i'm going to make double command with different msg box for different criteria, it going fail
1. This my Working code:
If Me.txtidborang.Tag & "" = "" = (DLookup("NoGerankod", "HutangKeseluruhan", "NoGerankod='" & Me.txtnogeran & "'")) Then MsgBox "Grant Number Invalid", vbOKOnly Me.[cbostatuspembayaran] = "Geran Negatif" CurrentDb.Execute "INSERT INTO Januari (bla..bla..bla..) End if
2. This my not working code:
If Me.txtidborang.Tag & "" = "" = (DLookup("NoGerankod", "HutangKeseluruhan", "NoGerankod='" & Me.txtnogeran & "'")) Then MsgBox "Grant Number Invalid", vbOKOnly Me.[cbostatuspembayaran] = "Geran Negatif" If Me.txtidborang.Tag & "" = "" = (DLookup("NoMatrikkod", "HutangKeseluruhan", "NoMatrikkod='" & Me.txtukmper & "'")) Then MsgBox "This Student still have debt ", vbOKOnly Me.[cbostatuspembayaran] = "Geran Aktif"
CurrentDb.Execute "INSERT INTO Januari (bla..bla..bla..)
End if End if
Q: How can i combine two dlookup together for different msg box?
I am new with ms Access. I am using 2013 version and stuck with "pretty" easy task.
When I create the form, the values are inserted/updated constatly as I leave the input components. However I would like to insert/update the record only when I click the button. How to do that?
I have form with these info : customer (Table), EnterDate (Button) and customersub (subform), i want to enter date into Date column using form with button.
example
ID name sample date 1. John A .... 2. Michel B .... 3. Jack C .....
into like this
ID name sample date 1. John A 2/2/2014 2. Michel B 2/2/2014 3. Jack C 2/2/2014
I try this this sql. but the date only insert/update for avery row i was select.
Q: How i can make sure i put one date.. it will insert for every row just one click.
Private Sub EnterDate_Click() CurrentDb.Execute "UPDATE Customer " & _ "SET Date='" & Me.insertdate & "'" & _ "WHERE ID= " & Me.Costumersub.Form.Recordset.Fields("ID") End Sub
Hi. I have two forms that both look at the same table. One form is for inputting data and the second for is for closing the job. I want to create a button that when clicked automatically changes a field on the input form and also fills in the current date on a field displayed on the closeout form. I then want it exit my two forms and take me back to my switchboard. Can anyone out there help?..Thanks.
Hi all, Not sure if this is in the right section but heres my question.
How can i gett a button to open a word document and put in specific information. for example. to send a client a letter, the button would open a word doc with the specfic client data in it.
Also a button to start a mail merge with all client records held on the db.
Well the title says it all. I need to create a button to lock the info on the form so it can't be edited and at the same time insert the date. Any ideas?
I have two tables, one is GENETIC and the other one is BoneSampleDNAprofile. Both tables have the field CY-Code. I want to create small form with 2 text box fields and one command button on the form to be able to insert CY-Code from the table GENETIC to designated DNA_LAB_Code in the table BoneSampleDNAprofile.
In that small form I would type DNA_LAB_Code and CY-Code where after pressing command button will insert CY-Code for the designated DNA_LAB_Code. This is continuous process after our Laboratory receive results from DNA laboratory. I have attached two .png files which are example of two tables.
I have an access form that fills an access table (MS Access 2003). Also, I have a Word (2010) document/template with some template text and empty fields which should be filled with data from access. Is it possible to insert a button in access form which would open a word document and populate appropriate fields with data from that form?
I have a form that I would like to update a picture on using VBA. The source of the picture path is in part a query that is not bound to the form. So far I have the following code that is pretty much working, but with a couple flaws.
Code: Private Sub Form_Current() LoadDefaultPicture End Sub Sub LoadDefaultPicture() Dim db As DAO.Database
[Code] ....
This is working. However, when I change the record the picture flashes the current picture once and then loads the new picture. It is like it reloads the current picture then loads the new one. I'm hoping there is a way to get rid of the flash.
Also, the code fails here: strDefaultPictureName = rs.Fields("AttachmentName")
When the query does not return a record. I can definitely fix this by adding an if statement to check for a record, but I'm kind of perplexed at why it is failing at that line. I would expect it to assign an empty string to that variable name and then fail on the next command where I try and set the ".Picture" property of the image.
I have two subforms: sf1 (Based on Table 1) and SF2 (Based on Table 2) in the first I have the fields and CODE QTY.
I need to insert into the second table, as many records as QTY. to enter a serial number for each unit of the item. For example:
TABLE 1 COD. QTY. 001 2 006 1
I must insert into Table 2 001 001 006
Dim num As Integer, contador As Integer contador = 0 num = Forms![FacturasRec_NSF]![FacturasRec_Det_SF].Form![CANLFR].Value Do While contador = num Insertar contador = contador + 1