A2K would be great,
I think I figured that the ID has to be a numeric field?
Cheers,
Graeme
:
It's been working for me for 8 years. If you'd like, I can drop a version in
either Access 97 or A2K at the
http://www.accessmvp.com website later today.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
in
message Thanks Arvin,
I tried that out but keep getting a "1" return.
I think my problem must be in the ID?!
By 'YourMainFormName' I presume that is the name of the form that
we are
working in (i.e. main form). I can't really seem to figure what's wrong as
the formula looks like it should work.
:
This is what I use in the Current event of my subform. It works
by using
the
default value of a textbox named txtLine which is bound to a
field in
the
subform's underlying table with the name of Line.:
Private Sub Form_Current()
On Error Resume Next
Dim x As Integer
x = DMax("Line", "YourTableName", "ID =" & Forms!YourMainFormName!ID)
If IsNull(x) Then
Me.txtLine.DefaultValue = 1
Else
Me.txtLine.DefaultValue = x + 1
End If
End Sub
The code numbering every set of records in the subform based on
the ID
of
the mainform. If you delete the last record it will not lose the next
value,
but if you delete a previous record, your sequence will not renumber.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
"Graeme at Raptup" <
[email protected]>
wrote in
message
I have looked at
www.lebans.com and found what looks like a solution
to my
problem. I need to number each row in the subform but I also
need to
use
that
number in a query or table.
Using '=RowNum([Form])' returns the correct numbering but does
not
seem to
populate any table records.
Am I just missing the obvious here?!