Question for Lynn Trap

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I have posted this message 3 times before

I have a form for ordering with a subform with all the
parts I need to order, my only problm is I need to get an
incrementing line number next to all the parts I need to
order and save it in the table under the order number.


eg. ord# 3

1 blue ring terminal
2 yellow ring terminal
etc...

so in the table orders I would like it to show
ord#3 1 blue ring terminal
ord#3 2 Yellow ring terminal
and so on and so on.


I got told you can do this with Dlookup or Dlast but I
dont know how


You help alot of people so I hope that ypou can help me.

Thanks in advance
Mark.
 
Thanks for replying Lynn,

But I have been sent to this site before and (maybe its
me) I couldn't get my database to do what it says.

=RowNum([Form]).

Does the [Form] have to be the name of the form its
working in or the subform name.

The next problem is I dont think that this function stores
the LineNumber into the table. (Which is what I need)

Please save me I'm going completely crazy
 
Hmmmmm....storing the line number in your table is going to be a different
ball game. You'll need to write a function that gets the maximum value of
the LineNumber field for a given master record. The SQL to do that would be
something like:

Select ForeignKeyToParentTable, Max(LineNumber)
From YourChildTable
Where ForeignKeyToParentTable = Forms!YourMainForm!KeyFieldInParentTable;

If that returns a null record, then set the LineNumber to 1. Otherwise, add
1 to the value returned by Max(LineNumber);

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Mark said:
Thanks for replying Lynn,

But I have been sent to this site before and (maybe its
me) I couldn't get my database to do what it says.

=RowNum([Form]).

Does the [Form] have to be the name of the form its
working in or the subform name.

The next problem is I dont think that this function stores
the LineNumber into the table. (Which is what I need)

Please save me I'm going completely crazy
-----Original Message-----
Mark,
Take a look at this website:

http://www.lebans.com/rownumber.htm

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm





.
 
Back
Top