Hi! Im extremly new ive been learing Libre for about 12 hours now, i made an extremely easy to use (im gonna transfer it to a old windows 7 pc) and see Form for a charity im doing work at, basically its a form to register new people coming in to file them, In this form i added basically everything but i wanted to add a way to add a file (a pdf) to attach to a single user (for example a user curriculum) i cant find any guides on how to do it, can someone guide me? Thanks you in advance
Search, how to attach an image or a BLOB, as it is the same principle. You wish to include something, wich is not understood by the database, therefore Binary large object. You will not be able to search for the image etc. as you can do with other fields.
.
The next question will be, if you put the pdf/image/blob inside your database, or keep it in an external place, and store only a reference (filename or better URL) as a text in your database. This is what I usually do, especially as this approach leaves the files accessible for other tools outside the database.
.
As you are at your first steps, you will probably use the default embedded database. Here avoid including images/blobs. An embedded database is extracted from the .odb on opening and has to be packed inside again on closing, so having blobs inside is slowing down the process.
.
For a “productive” database it is better to be not embedded unless you need to send this around to other people. You may read/google the topic “split database” on this.
I suggest using the built in file selection tool.
Edit the form.
Select the Form menu tab. Look for “File Selection” down past midway.
Click it and then click, hold, and drag on your form to draw the control rectangle near the desired position.
Hit Enter. You should see a control with a text box with a <Browse…> button attached. Clicking the browse button during runtime opens a file dialog window where you will find and select the file (pdf) you wish to link to the record. Now set the file selector “Control Properties” to the appropriate settings. There are no Data control properties, but in the Events tab, you will need to assign a macro to the “mouse button pressed” or released event. The macro basic script is the following:
Sub selFile(oEv as Object)
Dim objA,objB,objC as object
Dim varA,strA,strB as string
objA=oEv.Source.Model 'File selection control
objB=objA.Parent 'Form where control exits
objC=objB.columns.getbyName("urlLink") 'Column for the url Link in the form's underlying table
strA=objA.getCurrentValue()
If Len(objC.value())<1 then
objC.value()=strA
Else
If msgBox("OK to change the file link?",1)=1 then
objC.value()=strA
End if
End if
End sub
Place a text box with data field property = “urlLink” near the file selector to view the assigned url link. You can then use a button’s action property to opendocument/webpage, or assign another macro in the textbox event - mouse button pressed, to open the pdf (or other) file.