Use If/Then in your error handling code to catch Err.Number = 3021 and a message box to display the desired message.
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
where do i use the "if\then"? is it in the property sheet?
No. It needs to go in the error handling section of the procedure in which the error occurs. An example of such code is shown below.Code:Private Sub cmdNext_Click() On Error GoTo ErrorHandler ' Your code goes here Exit_cmdNext_Click: Exit Sub ErrorHandler: If Err.Number = 3021 Then MsgBox "Your message goes here", vbInformation Resume Exit_cmdNext_Click Else MsgBox Err.Number & ": " & Err.Description Resume Exit_cmdNext_Click End If End Sub
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
i have use the above code and it does present me with the error message, but i have to click twice on the next button for the error message to pop up?
any ideas?
Perhaps the first click takes you to a new, blank record?
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
iv checked properly once you reach the first or last record, you have to click twice for the message to popup, there is no change at all in between
Can you post a copy of your database?
If you go into record customer sales, bustbuy will only have 3 sales....
Thanks in advance, if you have any question please let me know
I think your issues are related to the Lookups at the table level ---but that's just a guess.
I'm not following your main form -Record Customer Sales.
When I set up a query to look at BestBuy sales I see 3 sales (Id 33,36, and 179) with ProductIds
(1,2,3), (3,4) and (1,3,10) respectively.
Anyway, good luck with your project.
hm where is the problem? is there a fix to it?
I was responding to this line. What is it supposed to mean? There are 3 SalesIds for BestBuy, so???If you go into record customer sales, bustbuy will only have 3 sales....
When you open a recordset, you check to see if it contains data. You can determine how many records exist in that recordset. You can also check if you are at the end of the recordset, and if you are take appropriate action.
When you get to the end of the recordset and attempt to go further, there is no further, you're at the end.
I have no idea what the specific error is with your set up. You are the one most familiar with your database, and user interface. We only know what you tell us and so far I've seen nothing about the purpose of your database or the business facts that the database is built on. As I said earlier, I don't know what the comment about BestBuy sales was meant to suggest/tell the reader. There are 3 Best Buy sales ids.
sorry if iam didnt make myself clear, the problem is (from the start) after going through records, when i get to the end access say there is no records, so this was replaced with a vb message box so its a user friend message rather then a runtime error.
once this was done and tested i noted as an example bustbuy has 3 sales (records) to get the user friendly error message up you have to click the next button twice on the last record and not once.
i used bustbuy as an example as i counted the amount of sales they have
sorry for any misunderstanding
thanks
When I open the Record Customer Sales form and go to any Customer (Shop Name) a number of records flash through the subform. Then I am left with a new SalesId , Quantity 1 is filled in as is today's date in the Date of Sale. Is this what is suppose to happen? It doesn't stop to show me the Sales records for the Shop????
As I said previously, I don't follow your user interface.
when you open the record customer sales, dont not use the combo box to select the shop, instead use the buttons on the right hand side (select a shop from the combo box will create a new sale id with todays date)
by clicking the next customer button twice this will take you to bestbuy shop. this shop has 3 sales made.
the problem is, for the friendly error message i have to click 5 times on the next sale buton and not 4, so on all the records once you get the end of the record you must click the next button twice and not once to get a message saying you are at the end of the records and there is more.
thanks