Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic Insert....Works, but have to cancel to change fields.

Status
Not open for further replies.

BigC666

IS-IT--Management
Mar 20, 2002
20
0
0
MX
This is the code I am using for the form.

Private Sub Thumb_Click()

'Automatic insert
On Error GoTo Err_Thumb_Click

RunCommand acCmdInsertObject

Exit_Thumb_Click:
Exit Sub

Err_Thumb_Click:

Const conErrDoCmdCancelled = 2501

If (Err = conErrDoCmdCancelled) Then
Resume Exit_Thumb_Click
Else
MsgBox Err.Description
Resume Exit_Thumb_Click
End If

End Sub

The problem is that after you insert an object and try to move onto anything else, the insert object dialog pops up again. Then after you cancel the second instance everything's happy! What am I missing here?
 
Allright this may sound like a stupid question....But where do I put it? Grin. I am a novice at this, pretty much feeling my way blindly along. Thanks for the tip though.
 
RunCommand acCmdInsertObject 'Your code
me!Thumb.requery 'My code
Exit_Thumb_Click: 'Your code
Exit Sub
Herman
 
Now it gives me an error message. Says I must save the field before I requery. Thoughts?
 
You could try:

RunCommand acCmdInsertObject 'Your code
RunCommand acCmdSave
me!Thumb.requery 'My code
Exit_Thumb_Click: 'Your code
Exit Sub

HTH
Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
That didn't do it either. Even putting the acCmdSave in there you still get the same error. I have tried it in several different places with the same or worse errors. Any more thoughts? Grin. I am still digging.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top