What have I done now

Gasman

Enthusiastic Amateur
Local time
Today, 18:56
Joined
Sep 21, 2011
Messages
17,484
:banghead:


Went to add a new entry in my DB.
Code for the button is
Code:
Private Sub cmdAddSubmitter_Click()
' Save the record first so the name appears in next form
If Me.Dirty Then
    Me.Dirty = False
End If
DoCmd.OpenForm "frmSubmitter", , , "IntroducerID = " & Me.IntroducerID, , acDialog, Me.IntroducerID
End Sub
Relationship is shown in Intro-Sub pic,
I added the Introducer and then wanted to add the submitter, but when pressing the Add button I get the error in the error pic?


To the best of my memory I have not changed anything in that area since I got it working.?:banghead:


Button is called cmdAddSubmitter and it does not even get into the code?


Tips where to look please.
 

Attachments

  • Intro-Sub.PNG
    Intro-Sub.PNG
    8.9 KB · Views: 248
  • error.png
    error.png
    18 KB · Views: 237
If the form is set to data entry, you can't pass a where clause to it ?
I'm guessing you pass the introducerID in the open args to set that as default on the new record, so not sure why you'd even want a Where clause ?
 
Hi Minty,
At home now, so will check on Monday, but I doubt the form is set to data entry. I have avoided that way of doing things as it has caught me out in the past.?

The WHERE was probably just to show the Submitters for that particular Introducer.

I haven't looked at the target form as I did not even get to the debugging point in that code set at the If Me.Dirty line

In fact I am so sad, I have a copy of the FE at home, and that has Data Entry set to No. I would not have it different in work, but will check.

I *think* I might have made this mistake before, where I mislabled a label with the same name.?

Will need to check on Monday.

Have a good weekend, I am going to try and forget about it until Monday. :D
 
Thank you Paul,

I will investigate that method if I cannot get to the bottom of it any other way.
The form AFAIK has not been touched since first created as I used the same method for other forms.



I had a perfectly good form button that I added a little code to and it suddenly started throwing an error like that. It's a shot in the dark, but this resolved it for me:

http://allenbrowne.com/ser-47.html#SaveAsText
 
Sounds like a bit of corruption to me as well (in which case SaveAsText/LoadFromText should do the trick).

Do you compact/repair often? Regular C/Rs help prevent this (I usually do it every time I take backup of the file, which is just after any significant development is complete... couple times a day at least).

Importing everything into a clean database is another way to help get rid of whatever gunk is causing the issue, as is perhaps running a /decompile on it. In all cases, be sure to grab a backup of the file prior, just in case (they're all invasive operations).

Cheers
 
Well it seems a decompile/compile solved the problem.


Will need to remember that as first port of call in the future.:banghead:


Thanks for all the replies.
 

Users who are viewing this thread

Back
Top Bottom