Double Click Event To Handle Empty Field (1 Viewer)

JohnMichael72

Gold Supporter
Local time
Today, 01:43
Joined
Jul 25, 2019
Messages
11
Requesting your assistance with something that I am sure you will find super easy; however I am struggling. I have a double click event set up on a subform field that when clicked opens another form to that record, working amazingly well. I would like to add some code that allows the user to click on an empty field of the subform and it will open up the same form to the acFormAdd property. The code I have so far is

Code:
Private Sub AttDescription_DblClick(Cancel As Integer)
Dim MyGUID As String
On Error GoTo Err_YourButton_Click

MyGUID = StringFromGUID(Me!AttachID)
MyGUID = MID(MyGUID, 7, 38)

stLinkCriteria = "[AttachID]='" & MyGUID & "'"
DoCmd.OpenForm "frmAttachments", , , stLinkCriteria
Exit_YourButton_Click:
    Exit Sub
Err_YourButton_Click:
    MsgBox Err.Description
    Resume Exit_YourButton_Click
End Sub

I would definitely appreciate any assistance you can give!

John
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 01:43
Joined
Aug 30, 2003
Messages
36,125
Along the lines of:

Code:
If Len(Me!AttachID & vbNullString) = 0 Then
  'open form in add mode
Else
  'your existing code here
End If
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:43
Joined
May 7, 2009
Messages
19,234
the question is how do you generate the AttachID (string)? do you have another field that is GUID?
 

Users who are viewing this thread

Top Bottom