Access 2013 User Defined Function call from on click not working same as 2007

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • imagecko
    New Member
    • Oct 2016
    • 2

    #1

    Access 2013 User Defined Function call from on click not working same as 2007

    I have a button on a form. in the on click I am calling a user defined function. If there are no letters it appears like this:
    =showsystemdeta ils(12345)

    if there are letters it autodefaults to this:
    =showSystemDeta ils([D05013368])

    Here is my code.

    Public Function showSystemDetai ls(ID)
    On Error GoTo showSystemDetai lsErr

    Dim stDocName As String
    Dim stLinkCriteria As String
    Dim stSysNum As String

    stSysNum = "ID"
    stDocName = "frmLookup"
    stLinkCriteria = "[system #]=" & "'" & stSysNum & "'"
    DoCmd.openForm stDocName, , , stLinkCriteria

    Exit Function

    showSystemDetai lsErr:
    MsgBox Err.Description

    End Function



    For some reason it doesn't like the letter and errors out. this DB was originally written when there were not letters in the system # field. There now are and I do not know how to work around this so that the frmLookup opens with the proper data present. Please help. Thank you very much in advance. Also, I am working with Access 2013 now, originally used 2007.
  • imagecko
    New Member
    • Oct 2016
    • 2

    #2
    Hello again, perhaps I did not put enough detail. In the on click property I'm typing =showsystemdeta ils(1234) Showsystemdetai ls is the user defined function. the (1234) is the computer ID. This works perfectly when there are only numbers in the computer ID. It walks through the user defined function, opens the form named frmLookup with the details for computer 1234. If the computer ID includes a Letter, such as (D013456)....wh ich is how all of our computers are now ID'd. Brackets are automatically placed around the computer ID [(D013456)] and the code runs but the frmLookup opens blank. I need frmLookup to open populated with computer ID data for what is in the parenthesis. Please help, and I'm grateful in advance for your assistance.

    Comment

    Working...