I am suggesting that according the MS documentation, the macroerror does not work in VBA - I'm suggesting you should be testing whether or not it does work.
In vba I would expect you to use
if err.number<>0....
I am suggesting that according the MS documentation, the macroerror does not work in VBA - I'm suggesting you should be testing whether or not it does work.
In vba I would expect you to use
if err.number<>0....
Good morning. Just change your code so it looks like this.
Code:'------------------------------------------------------------ ' Command50_Click ' '------------------------------------------------------------ Private Sub Command50_Click() On Error GoTo Command50_Click_Err 'On Error Resume Next' DoCmd.GoToRecord , "", acNewRec DoCmd.GoToControl "partnumber" ' If (MacroError <> 0) Then ' Beep ' MsgBox MacroError.Description, vbOKOnly, "" ' End If Command50_Click_Exit: Exit Sub Command50_Click_Err: MsgBox Error$ Resume Command50_Click_Exit End Sub
I have just tried this - no change. I still get the warning message etc......
Now add : MsgBox "Dirty = " & Me.Dirty
...before the 1st DoCmd.
Done that and I now get a warning message which says
Dirty = False
and then initial run time error message appears......
Making progress. We've eliminated a Dirty record being a problem. remove that line now. I think it has something to do with going to a new record and your table specifications. Comment out the
DoCmd.GoToControl "partnumber"
line.
Done that
Dirty = False message has now gone but the intial run time error is still there....
Any chance you could post your db? If so then Compact and Repair first and zip it up.
Unfortunatley, I can'tsend the whole dataase because there is some "sensitive" information contained on it.
Is there any way I could just send you the bits you need ........?
If so, does it make any difference that the form is in the Front end and the tables which support are in a Back end ?
Well, I would need the form and its RecordSource tables. Is that possible?
I should admit I rarely use the DoCmd function. I usually use a DAO.Recordset. Are you using DAO or ADO?
Sorry, I don't understand the question....
See if this throws an error:
Code:'------------------------------------------------------------ ' Command50_Click ' '------------------------------------------------------------ Private Sub Command50_Click() On Error GoTo Command50_Click_Err Me.Recordset.AddNew ' DoCmd.GoToRecord , , acNewRec ' DoCmd.GoToControl "partnumber" Command50_Click_Exit: Exit Sub Command50_Click_Err: MsgBox Err.Number & " - " & Err.Description Resume Command50_Click_Exit End Sub
I have imported most of the tables you need and the forms you need into a seperate database.
The size of the current file is 7.87 MB.
As I have never sent anything like this before, can you tell me how to zip the file and then how to attach the zipped file.
Once I do that I can send it to you......
Ends up with the same error................