PC Review


Reply
Thread Tools Rate Thread

Autonumber with a datasheet view

 
 
=?Utf-8?B?amJwaG9lbml4?=
Guest
Posts: n/a
 
      2nd Apr 2007
I have a main form (enter_RMA) with a subform (Ord_Line) linked by the
RMA_ID. The main form has customer info, order date, ship date, order
status, etc. The subform has specific order data. For example on the
subform - the user chooses a part_id, the qty (Quantity), and some other data
is automatically populated based on the part_id. If the order contains more
than 1 part the user goes to the next line and repeats the process till all
the parts are ordered. There is a field called Line_No which has to be
entered. Right now the user has to manually enter a new line number. Is
there a way to automatically have the Line_No increment by 1 each time a new
part is added to the order?
 
Reply With Quote
 
 
 
 
Dave Emmert
Guest
Posts: n/a
 
      3rd Apr 2007
You could create a field (as a number) to for this number. For the below
code, I choose Line_Num. Then create a function to set this number:

Public Function OneUp(OrderNum as Long) As Long
dim db as database, rs as dao.recordset
set db = currentdb
set rs = db.openrecordset(Select * From Ord_Line Where RMA_ID = " &
OrderNum & ";")
if rs.recordcount > 0 then
rs.movelast
OneUp = rs!Line_Num + 1
Else
OneUp = 1
end if
rs.close
db.close
End Function

I would then set the default value to that field as OneUp([RMA_ID])

The problem is that if the user deletes a record from the table, this number
will remain the same and not adjust to the new order. To fix this issue,
you would have to write another subroutine to reorder the numbers.

Dave Emmert



"jbphoenix" <(E-Mail Removed)> wrote in message
news:37471D2E-C2AA-41C7-9100-(E-Mail Removed)...
>I have a main form (enter_RMA) with a subform (Ord_Line) linked by the
> RMA_ID. The main form has customer info, order date, ship date, order
> status, etc. The subform has specific order data. For example on the
> subform - the user chooses a part_id, the qty (Quantity), and some other
> data
> is automatically populated based on the part_id. If the order contains
> more
> than 1 part the user goes to the next line and repeats the process till
> all
> the parts are ordered. There is a field called Line_No which has to be
> entered. Right now the user has to manually enter a new line number. Is
> there a way to automatically have the Line_No increment by 1 each time a
> new
> part is added to the order?



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to use filter in datasheet view or add criteria to query indesign view HouBMan Microsoft Access Queries 2 3rd Mar 2010 04:50 PM
switch from datasheet view to form view and reapply filter/sort Haggis Microsoft Access 0 19th Apr 2008 12:12 AM
Form in datasheet view will not show my 2 subforms in datasheet vi =?Utf-8?B?VGhlMm5kMDA3YmFiZQ==?= Microsoft Access Forms 1 5th Mar 2007 07:41 PM
Query with Multi Column view ( 8 columns datasheet view) =?Utf-8?B?UEE=?= Microsoft Access Queries 3 8th Mar 2006 03:11 PM
How to toggle between the datasheet view of a query & data entry view of a form Dave Dettman Microsoft Access Forms 2 13th Jan 2004 11:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:49 PM.