smercer
Registered User.
- Local time
- Tomorrow, 08:59
- Joined
- Jun 14, 2004
- Messages
- 442
Hi all
I am having problems with this code. I works only when the right record is the first record, however when the first record is not the record with the same ISBN number as the book that is scanned, it will give a error (see attachment)
By the way, I have tried both of the lines in between the "Do while" and "Loop" by changing which line has the comment apostrophe
This is my resolution to my problem that I had when I wanted write code for GoToRecord line. this is also nested in a else If statement. would this have any effect to this?
here is the full if statement from the ELSE line
Thanks to all in advance
I am having problems with this code. I works only when the right record is the first record, however when the first record is not the record with the same ISBN number as the book that is scanned, it will give a error (see attachment)
Code:
Do While Me!sfrm_Current_Sales_For_Book_Des!ISBN_Number <> Me!With_ISBN_Number
'DoCmd.GoToRecord , , acNext
DoCmd.RunCommand acCmdRecordsGoToNext
Loop
By the way, I have tried both of the lines in between the "Do while" and "Loop" by changing which line has the comment apostrophe
This is my resolution to my problem that I had when I wanted write code for GoToRecord line. this is also nested in a else If statement. would this have any effect to this?
here is the full if statement from the ELSE line
Code:
Else
If Not IsNull(Me![ISBN_Lookup].Value) Then
'and now for the each record in the Each_Book Subform
sfrm_Current_Sales_For_Book_Des!ISBN_Number.SetFocus
'DoCmd.FindRecord S_ISBN, acEntire, False, , False, acCurrent, True
Do While Me!sfrm_Current_Sales_For_Book_Des!ISBN_Number <> Me!With_ISBN_Number
'DoCmd.GoToRecord , , acNext
DoCmd.RunCommand acCmdRecordsGoToNext
Loop
Me!sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View.SetFocus
DoCmd.GoToRecord , , acNewRec
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
End If
End If
Thanks to all in advance
Attachments
Last edited: