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.
=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.
Comment