View Full Version : DMAX function with autonumber


punter
01-31-2007, 12:39 PM
Hi,

Below is the macro that has been recorded in access:

Option Compare Database
Option Explicit

Private Sub Add_record_to_database_Click()
On Error GoTo Err_Add_record_to_database_Click


DoCmd.GoToRecord , , acNewRec

Exit_Add_record_to_database_Click:
Exit Sub

Err_Add_record_to_database_Click:
MsgBox Err.Description
Resume Exit_Add_record_to_database_Click

End Sub
Private Sub Add_new_record_once_you_written_down_Unqiue___Clic k()
On Error GoTo Err_Add_new_record_once_you_written_down_Unqiue___ Click


DoCmd.GoToRecord , , acNewRec

Exit_Add_new_record_once_you_written_dow:
Exit Sub

Err_Add_new_record_once_you_written_down_Unqiue___ Click:
MsgBox Err.Description
Resume Exit_Add_new_record_once_you_written_dow

End Sub
Private Sub Add_new_record_Click()
On Error GoTo Err_Add_new_record_Click


DoCmd.GoToRecord , , acNewRec

Exit_Add_new_record_Click:
Exit Sub

Err_Add_new_record_Click:
MsgBox Err.Description
Resume Exit_Add_new_record_Click



End Sub

Here is the piece I'm tryhing to add to the macro:

DMAX("Unique #", "BOL Information") + 1

I have been trying various combinations but I can't get it work. Any thoughts?

Thank you in advance,

Eddie.

KeithG
01-31-2007, 01:49 PM
What error are you receiving?

punter
01-31-2007, 02:01 PM
What error are you receiving?


Various ones. I'm getting "expects =" sometimes and other systax errors.

It seems to me the code should fit in there somewhere but I'm not sure where. Am I barking up the wrong tree?

Thank you for your reply.

Eddie.