Open in Edit Mode

S

ServiceEnvoy

I currently have a double click function to open another form by
double clicking a unique id number. Is there a way to set up the
double click to open the other form in "add" mode if there is no
number present in the field? Here is the current double click vba I
have:

Private Sub ServicerID_DblClick(Cancel As Integer)
DoCmd.OpenForm "servicersAll", , , "[ID] = " & Me.[ServicerID] & ""
End Sub
 
S

Stuart McCall

ServiceEnvoy said:
I currently have a double click function to open another form by
double clicking a unique id number. Is there a way to set up the
double click to open the other form in "add" mode if there is no
number present in the field? Here is the current double click vba I
have:

Private Sub ServicerID_DblClick(Cancel As Integer)
DoCmd.OpenForm "servicersAll", , , "[ID] = " & Me.[ServicerID] & ""
End Sub

Private Sub ServicerID_DblClick(Cancel As Integer)
Dim DataMode As Integer

DataMode = Iif(Me.ServicerID & "" = "", acFormAdd, acFormEdit)
DoCmd.OpenForm "servicersAll", , , "[ID] = " & Me.[ServicerID] & "",
DataMode
End Sub
 
M

Marshall Barton

ServiceEnvoy said:
I currently have a double click function to open another form by
double clicking a unique id number. Is there a way to set up the
double click to open the other form in "add" mode if there is no
number present in the field? Here is the current double click vba I
have:

Private Sub ServicerID_DblClick(Cancel As Integer)
DoCmd.OpenForm "servicersAll", , , "[ID] = " & Me.[ServicerID] & ""
End Sub


If IsNull(Me.ServicerID) Then
DoCmd.OpenForm "servicersAll", , , , acFormAdd
Else
DoCmd.OpenForm "servicersAll", , , "ID=" & Me.ServicerID
End If
 
S

ServiceEnvoy

ServiceEnvoy said:
I currently have a double click function to open another form by
double clicking a unique id number. Is there a way to set up the
double click to open the other form in "add" mode if there is no
number present in the field? Here is the current double click vba I
have:
Private Sub ServicerID_DblClick(Cancel As Integer)
DoCmd.OpenForm "servicersAll", , , "[ID] = " & Me.[ServicerID] & ""
End Sub

If IsNull(Me.ServicerID) Then
DoCmd.OpenForm "servicersAll", , , , acFormAdd
Else
DoCmd.OpenForm "servicersAll", , , "ID=" & Me.ServicerID
End If

Thanks a million. You guys make it look so easy. I'm trying to learn!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top