I know just enough programming to get myself in serious trouble. I'm building a database where I want to run a function that does the same thing each time. The only problem is the button appears on various forms. I know I need to use a public function. I managed to get the function to work as a private sub on one form but when I moved it to a module and made it into a public function, it gave me an error. It states that I have entered an expression that has no value. I suspect the problem is the link between the first form (Various Forms) and the second form (Log-Memo Line Form).
In each form, the common link is the HL# (The Transaction ID#). HLCtrl refers to a text box control on one form (the various parent forms). [HL#] refers to a text box control in the [Log-Memo Line] Form. My other issue is that the HLCtrl control has different names in different forms. Should I rename the controls to be the same name?
This is the code
Public Function Memo_Line()
On Error GoTo Memo_Line_Err
Call saver
DoCmd.OpenForm "Log-Memo Line", acNormal, "", "[HL#]=" & "'" & HLCtrl & "'", , acNormal
Call ClipBoard_SetData([Forms]![Log-Memo Line]![Memo])
MsgBox ([Form_Log-Memo Line].[Memo] & "---- copied to Clipboard."), vbInformation, "Clipboard Details"
DoCmd.Close acForm, "Log-Memo Line"
Memo_Line_Exit:
Exit Function
Memo_Line_Err:
MsgBox Error$
Resume Memo_Line_Exit
End Function