I have a couple of routines that need to be performed several times from different controls in my program. I believe it would be best for me to create a function that can be called from various sub routines. I am not sure how to do this so this is what I have done so far.
_HERE IS THE FUNCTION_______________________________________
Public Function DwgLockStatus(item As String) As Boolean
'Create connection
Dim cnn2 As ADODB.Connection
Dim lockRecordSet As New ADODB.Recordset
Set cnn2 = CurrentProject.Connection

Dim isLocked As Boolean

lockRecordSet.ActiveConnection = cnn2
lockRecordSet.Open "Select lockInd AS islocked From dwgTbl Where partNum = '" & _
item & "'"
dwgLock = isLocked

End Function
_HERE IS THE CALL_______ I don't know how to get the value from the function back to the sub routine______________________________
Check status of part
Call DwgLockStatus(item)

isLocked = DwgLockStatus()
If isLocked = True Then
MsgBox "Part curently locked for ECO", vbInformation, "Part Update Error"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If