Stopping unwanted messages

Les Blair

Registered User.
Local time
Today, 07:30
Joined
Sep 10, 2007
Messages
49
On my form I am submitting a query and when it runs I get messages from the completion. I put the SetWarnings False and True in to end the messages. Now when it runs I get a different message that says:

"You Canceled the previous operation" and wants me to reply 'OK'

Can someone tell me why I get this and how to stop it. I don't remenber every getting this prior to putting the setwarnings in but now I get even when I remove them.

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenQuery "InsertNewProspects", acViewNormal, acAdd
DoCmd.RunCommand acCmdSaveRecord
DoCmd.SetWarnings True
If Not IsNull(Me.txtCaseTrackNbr) Then
strLinkCriteria = "[Case Track Nbr] = '" & Me.txtCaseTrackNbr & "'"
End If
If Me.txtCaseType = "MED" Then
DoCmd.OpenForm FormName:="frmMedProspects"
Form!frmMEDProspects.Filter = strLinkCriteria
Form!frmMEDProspects.FilterOn = True
Else
DoCmd.OpenForm FormName:="frmSBDProspects"
Form!frmSBDProspects.Filter = strLinkCriteria
Form!frmSBDProspects.FilterOn = True
End If
 
HI,

I would start by putting a break in at the first line and stepping through the code.

The new message may be coming form a different part of your code not related to the original warnings.

I often find that a message like this is actually caused by an error, maybe a data mismatch or something that bares no relation to the warning given.

Good luck

Sue
 
Now nothing is working. the save record says that you can run this now and every other docmd goes to the err routine.
 
HI,

That doesn't sound good!

I would guess your query has a problem.

Try running it by opening the query and see if there are any error messages there.

If you like post a zip file of your database and I'll have a look, can't come up with any answers from what's in your post so far.

Sue
 
You have to open the frmMainMenu and the problem is in the NewCaseTrack. You get there by pressing the cmdNewCaseTrack#. Once there add a new record by entering something in the Case Name field and then select either MED or SBD from the Case Type Drop Down I have been using the MED and then press the New Prospect cmd.

Thanks in advance for your help in this matter. I have attached a copy.
 

Attachments

Hi Les,

I think I've fixed it.

The problem was with your openform command.

It didn't seem to like you setting a filter after the openform.

I have used the folowing code instead and it seems fine

If Me.txtCaseType = "MED" Then
DoCmd.OpenForm "frmMEDProspects", , strLinkCriteria
Else
DoCmd.OpenForm "frmSBDProspects", , strLinkCriteria
End If

instead of

If Me.txtCaseType = "MED" Then
DoCmd.OpenForm FormName:="frmMEDprospects"
Form.Filter = strLinkCriteria
Form.FilterOn = True
Else
DoCmd.OpenForm FormName:="frmSBDprospects"
Form.Filter = strLinkCriteria
Form.FilterOn = True
End If

If you dont have FormName:= you will get a hint as you type the command telling you which parameters go where.

Good luck with this.

Sue
 
Thank you Sue, This worked. Sometimes I don't understand when to use the FormName: when not to or when to set the name to a string. :)

Again, Thank you very much.:D
 
Hi Les,

Glad to help.

I have always used the format I showed you, I didn't even know about the other one, so you should be fine to stick with the one I use.

Good luck with the rest of it.

Sue
 
Sue,
Since you have a copy of the Database could you look at something that I found and don't understand. I have a search process. if I try to enter a number in the txtFilterCaseTrackNbr that is 4 pos or less it works. but if I enter a number that is greater that 4 say 5 or 6 pos it get a overflow error. I don't understand why it is defined as "Integer". When I changed it to "Long" it just sit that and does not return any line from the search.:confused:
 
Hi Les,

I'll have a quick look.

Which form should I be looking at?

Sue
 
On the Main Menu is a search function (it has a Binocular) for a pic. when you press the cmd it takes you to another form. On this form if you put '9906' in the 'Case Track #' yellow box and press the filter it will show the correct records. if you double click any of the rows it will take you to the correct screen. but if you put '57069' in the yellow box and press the filter you will get a 'overflow' error 6. if you select the MED option from the 'Case Type' drop down and press the filter and then go to the bottom of the results and select any of the 'case track #' that have atleast 5 digits it just sets there and goes nowhere.:confused:
 
Hi Les,

The maximum number you can have in an integer is 32,767 so putting in 57069 gives an overflow because the number is just to big.

Change intnum to be dimentioned as long and you can go up to 2,147,483,647 which should last you a while!

Sue
 
Thank you Sue, I keep forgetting that integer is a smaller number than Long. I will learn. Again thank you.
 

Users who are viewing this thread

Back
Top Bottom