help with changing parameter in DMAX!

  • Thread starter Thread starter Mattias
  • Start date Start date
M

Mattias

Hi

Have this code working ok referencing to "Objekt" as a name of a table.
I have some problems to make it work when reference the query name of the
record source for the active form.

Thank you in advance

Mattias



Private Sub Form_BeforeInsert(Cancel As Integer)
If Me.NewRecord Then
Me.Utropsnummer = DMax("Utropsnummer", "Objekt") + 1
End If
End Sub
 
Mattias,

What problems are you experiencing?

By the way, it seems to me that the 'If Me.NewRecord' line in your
code is not necessary... As far as I am aware, the BeforeInsert event
only takes place for new records anyway.

- Steve Schapel, Microsoft Access MVP
 
Back
Top