Search results

  1. M

    Select case function

    Basically what I want to do is to: Case1: The first character in the string = # and the last character in the string = # Delete both # Case 2: First character in the string = # Delete the # at the beginning Case 3: Last character in the string = # Delete the # at the end. So I need to set...
  2. M

    Select case function

    Can anyone help me understand why when I run the code, VBA always skips to the last Case Else scenario, regardless of if there is a hash at the beginning, the end or both of the control Me.Liste_documentation.column(3). Dim PathName As String, RemoveHashL As String, RemoveHashR As String...
  3. M

    Missing functions from VBA

    My references: Visual Basic For Applications Microsoft Access 14.0 Object Library OLE Automation Microsoft Office 14.0 Access database engine Object Library Microsoft Office 14.0 Object Library Company references: Visual Basic For Applications Microsoft Access 14.0 Object Library OLE...
  4. M

    Missing functions from VBA

    I still get a compilation error even if I add the "Microsoft Scripting Runtime". "Type defined by user not defined." Code: Dim fd As FileDialog
  5. M

    Missing functions from VBA

    Hi all, I have been developing some new features for an access data base that my company uses. I have been creating these new functions with VBA in a database that I have made by myself. Having created them and now wanting to transfer the VBA code over to the new Access file, it appears that...
  6. M

    Shell function and Run time error 5

    Thanks ! The application.followhyperlink method worked perfectly. In what case would it be preferable to use the shell method as opposed to the follow hyperlink ? Thank, MOR
  7. M

    Shell function and Run time error 5

    Positive. I copied and pasted the file path.
  8. M

    Shell function and Run time error 5

    Hi Paul, Thanks very much. Apologies if I've used the code wrong but have done this... Private Sub Liste_Documentation_DblClick(Cancel As Integer) Dim PathName As String PathName = Me.Liste_Documentation.Column(2) Debug.Print PathName Dim retVar As Long retVar = Shell(PathName)...
  9. M

    Shell function and Run time error 5

    Hi there, I'm looking to use the shell function to dynamically call different pdfs that are in a directory. However I'm getting run time error 5 "Invalid procedure or call argument". Here is the code (very basic I know).. Private Sub Liste_Documentation_DblClick(Cancel As Integer) Dim...
  10. M

    Automatic population of field in adding a new record

    JHB, Thank you for this, but I have a quick question. When I try to run the code in the On Open event, I get the error "You can't assign a value to this object". However, if I run the code from another event, eg OnClick event for the control in question, then the code works with no problems...
  11. M

    Automatic population of field in adding a new record

    Hello everyone, I would like some help in determining how to automatically populate a certain field. To add some context, I have a form which registers the details of a contact with standard information of contact details. There is a subform which shows the different products that the client...
  12. M

    Opening a report: Error 3211: Database Engine could not lock table

    Thanks that worked perfectly!! What difference does it make between locking a report and not locking?
  13. M

    Opening a report: Error 3211: Database Engine could not lock table

    Hello all, I have a small problem that I would like to have some help with. I have a form that contains a subform. The subform is a datasheet which calls the results of a query of 4 tables (tbl_companies, tbl_deals, tbl_products, tbl_vl). In the main form there is a button which opens a report...
  14. M

    Preventing data entry duplicates

    Yeah I struggled to understand it but will have a play around, but thank you very much for pointing me in the right direction. I would never have figured this out by myself!
  15. M

    Preventing data entry duplicates

    Dim criteria As String criteria = "Tbl_VL.produit = '" & Me.produit & "' AND Tbl_VL.vl_date = #" & Me.vl_date & "#" If DCount("VL_id", "Tbl_VL", criteria) > 0 Then MsgBox "Il existe déjà un enregistrement pour ce produit et la date associée." Me.Undo End If How do I get VBA to read the date...
  16. M

    Preventing data entry duplicates

    Hi PBaldy, I've just run the code and you were right, the VBA recognises the code as an american date format and passes the date entered as an american date. Therefore, if I had a date in my table of 01/07/2013 and then re-entered this date into a control (as seen before) then the afterupdate...
  17. M

    Preventing data entry duplicates

    It won't let me post the database as there is a security token missing? But running the print returns this: Tbl_VL.produit = 1 AND Tbl_VL.vl_date = #01/07/2013# The code now runs as I've removed the apostrophes for the first field but it doesn't actually filter the results. I put in a...
  18. M

    Preventing data entry duplicates

    Dim criteria As String criteria = "Tbl_VL.produit = '" & Me.produit & "' AND Tbl_VL.vl_date = #" & Me.vl_date & "#" If DCount("VL_id", "Tbl_VL", criteria) > 0 Then MsgBox "Il existe déjà un enregistrement pour ce produit et la date associée." Me.Undo End If No for...
  19. M

    Preventing data entry duplicates

    Yeah sorry I was playing around trying to get it to work. How do I threfore tell VBA what the two data types are? The field Tbl_VL.produit is a text field and the field Tbl_VL.vl_date is a date field and then I have contained this all within a string? Sorry about this... I ahve deleted the...
  20. M

    Preventing data entry duplicates

    I've tried running this woth the following code yet I'm getting hit with error #3464: Type of data is incompatible in the criteria expression. Also why is it better to run in the before update? Thank you! Private Sub vl_date_AfterUpdate() Dim criteria As String criteria = _...
Back
Top Bottom