smercer
Registered User.
- Local time
- Tomorrow, 08:42
- Joined
- Jun 14, 2004
- Messages
- 442
Hi all
I am having a strange problem, and that is the line
DoCmd.GoToRecord , , acNewRec
is not working. What happens is when the user scans a barcode, this coding will overwrite the first record (the only record) and the record in the sub form. which means that the form is completely ignoring the go to record lines.
What is supposed to happen is each time the user scans a book, there will be a new temporary record until the end of the sale.
I am having a strange problem, and that is the line
DoCmd.GoToRecord , , acNewRec
is not working. What happens is when the user scans a barcode, this coding will overwrite the first record (the only record) and the record in the sub form. which means that the form is completely ignoring the go to record lines.
What is supposed to happen is each time the user scans a book, there will be a new temporary record until the end of the sale.
Code:
If IsNull(DLookup("[With_ISBN_Number]", "tbl_Current_Sales_For_Book_Des", "[ISBN_Number]=[With_ISBN_Number]")) Then GoTo first_ISBN
If Not IsNull(DLookup("[With_ISBN_Number]", "tbl_Current_Sales_For_Book_Des", "[ISBN_Number]=[With_ISBN_Number]")) Then GoTo ISBN_exists
first_ISBN:
'if there is no book copies (no ISBN Number the same) exist then
'This section is for the copying the sfrm_Current_Sales_For_Book_Des data over to sales form
Me!sfrm_Current_Sales_For_Book_Des.SetFocus
DoCmd.GoToRecord , , acNewRec
Me!sfrm_Current_Sales_For_Book_Des!ISBN_Number = Me!sfrm_Current_Sales_Book_Description!ISBN_Number
Me!sfrm_Current_Sales_For_Book_Des!Title = Me!sfrm_Current_Sales_Book_Description!Title
Me!sfrm_Current_Sales_For_Book_Des!Author_Surname = Me!sfrm_Current_Sales_Book_Description!Author_Surname
Me!sfrm_Current_Sales_For_Book_Des!Author_FName = Me!sfrm_Current_Sales_Book_Description!Author_FName
Me!sfrm_Current_Sales_For_Book_Des!Series = Me!sfrm_Current_Sales_Book_Description!Series
Me!sfrm_Current_Sales_For_Book_Des!Category = Me!sfrm_Current_Sales_Book_Description!Category
Me!sfrm_Current_Sales_For_Book_Des!Sub_Category = Me!sfrm_Current_Sales_Book_Description!Sub_Category
DoCmd.RunCommand acCmdSelectRecord
'and now for the each record in the Each_Book Subform
Me!sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View.SetFocus
Me!sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View!Book_ID = Me!sfrm_Current_Sales_Book_Description!sfrm_Each_Book_Sales_Selected!Book_ID
Me!sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View!ISBN_Number = Me!sfrm_Current_Sales_Book_Description!sfrm_Each_Book_Sales_Selected!ISBN_Number
Me!sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View!Cover = Me!sfrm_Current_Sales_Book_Description!sfrm_Each_Book_Sales_Selected!Cover
Me!sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View!Cost_Price = Me!sfrm_Current_Sales_Book_Description!sfrm_Each_Book_Sales_Selected!Cost_Price
Me!sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View!Sale_Price = Me!sfrm_Current_Sales_Book_Description!sfrm_Each_Book_Sales_Selected!Sale_Price
DoCmd.RunCommand acCmdSelectRecord
GoTo End_Me