473,769 Members | 4,584 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

EOF and BOF Errors

2 New Member
Part of the coding is listed below but when i run this it comes back with EOF and BOF error (Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record)

Error occurs on the line override = rsc("override") am new to programing and not sure where i would need to fix this error or what i would have to do.

The person we had do this is no longer working with us and the program to best of my understanding was built using Visual Basic 4.0

Would appreciate any help that you may give me.

Lloyd



'============== ============='
' UPDATE BUTTON PUSHED '
'============== ============='

Private Sub Command3_Click( )

product_name = MSHFlexGrid1.Te xtMatrix(MSHFle xGrid1.Row, 0)


If discount_check. Value = 0 Then


Set rsc = CreateObject("a dodb.recordset" )
rsc.Open "select * from products where product_name='" & product_name & "'", strDSN, 3, 1

override = rsc("override")

If rsc("discount_t his") = "1" Then
discount_rate = "0"
Else
discount_rate = glb_discount
End If
rsc.Close

If glb_wholesaleid <> "" And override <> "" Then
discount_rate = override
End If

txt_discount.Te xt = discount_rate

If txt_discount.Te xt = "" Then
txt_discount.Te xt = glb_discount
End If


Else
txt_discount.Te xt = 0
End If


If txtDataDrop.Tex t = "" Then
show_alert "PRODUCT"
txtDataDrop.Set Focus
Exit Sub
End If

If txtQuantity.Tex t = "0" Or txtQuantity.Tex t = "" Then
show_alert "QUANTITY"
txtQuantity.Set Focus
Exit Sub
End If

If txtWholesaler.T ext = "" Then

If txt_firstname.T ext = "" Then
show_alert "FIRST NAME"
txt_firstname.S etFocus
Exit Sub
End If

If txt_lastname.Te xt = "" Then
show_alert "LAST NAME"
txt_lastname.Se tFocus
Exit Sub
End If

If txt_address.Tex t = "" Then
show_alert "STREET ADDRESS"
txt_address.Set Focus
Exit Sub
End If

If txt_city.Text = "" Then
show_alert "CITY"
txt_city.SetFoc us
Exit Sub
End If

If txt_state.Text = "" Then
show_alert "STATE"
txt_state.SetFo cus
Exit Sub
End If

If txt_zip.Text = "" Then
show_alert "ZIP CODE"
txt_zip.SetFocu s
Exit Sub
End If

End If


If MSHFlexGrid1.Ro w > 1 And product_name <> "" Then
MSHFlexGrid1.Re moveItem (MSHFlexGrid1.R ow)
MSHFlexGrid1.Re fresh
MSHFlexGrid1.Ro w = 1
Else
Command1.Enable d = False
End If


If txtPrice_manual .Text <> "" Then
product_price = CDbl(txtPrice_m anual.Text)
t_price = product_price
Else
product_price = txtPriceHidden. Text
t_price = txtPriceHidden. Text
End If

If t_price = "0.00" Then
t_price = MSHFlexGrid1.Te xtMatrix(MSHFle xGrid1.Row, 7)
End If


On Error Resume Next

If t_price = "" Then t_price = Round(txtPrice_ manual.Text, 2)
the_price = CDbl(t_price * txtShipped.Text )


If txtWholesaler.T ext <> "" Then

On Error Resume Next

is_wholesale = "YES"
wholesale = txtWholesaler.T ext

Set rs = CreateObject("a dodb.recordset" )
wholesale = Split(wholesale , " ")
wholesaler_id = wholesale(1)
wholesale = Replace(wholesa le, "'", "''")
rs.Open "select * from users where user_id = " & wholesaler_id, strDSN, 3, 1

If Not rs.EOF Then
wholesale_disco unt = rs("discount")
wholesale_id = wholesaler_id
wholesale_taxid = rs("tax_number" )
End If

rs.Close
Set rs = Nothing

End If
Feb 8 '07 #1
4 2738
iburyak
1,017 Recognized Expert Top Contributor
It looks like record with this name wasn't found
Put this code before line that gives you an error which just checks if actual record was found and exists if not.
[PHP]
IF rsc.bof and rsc.eof then
Set rs = Nothing
Exit sub
End if
override = rsc("override")[/PHP]

I am not sure of your business rules but it might be the case where user hits an update button when actually needed insert. If you have insert button you can call it instead from update button like this:
[PHP]
IF rsc.bof and rsc.eof then
Set rs = Nothing
call InsertButtonNam e_click
Exit sub
End if
override = rsc("override")[/PHP]
Feb 8 '07 #2
ultraclassic
2 New Member
Hi, thanks for the code you replied us. It seems to have fixed the problem of it erroring out, however, by entering that code, we cannot apply any discounts to the item we are trying to add.

To sum it up, the code you gave us let us insert the new item to the customers order, however we cannot override manually the discount given on a particular item.

Right now we may assume that the employee working on this program has left out some key items to make the prorgram complete, but its hard to say since I do not know how exactly he coded this particular portion.

If you have any other suggestions it would be appreciated.
Feb 8 '07 #3
Killer42
8,435 Recognized Expert Expert
I won't discuss the EOF/BOF thing, as Iburyak has dealt with that. As for the rest...

I think you need to pinpoint why the name doesn't match. In this
Expand|Select|Wrap|Line Numbers
  1. rsc.Open "select * from products where product_name='" & product_name & "'", strDSN, 3, 1
  2. override = rsc("override")
you need to investigate where (or whether) the variable product_name was populated, and why it doesn't match what you expected to find in field [products].[product_name].

If you find that it does appear to match, consider the possibility that the match might be case-sensitive. (I'm not at all certain that is even possible, though).

Also, if I might be permitted a personal observation, I think it is unnecessarily confusing to use identical names for database fields and variables in this way (Eg. product_name). :) I realise you're just trying to take over someone else's unfinished code, but I think that's worth keeping in mind.

And one last point. When posting code, please put [C O D E] and [/ C O D E ] tags around it. (Remember to leave out the spaces I embedded in the tags here, and do a "Preview Post" before submitting, to see whether it worked.)
Feb 9 '07 #4
iburyak
1,017 Recognized Expert Top Contributor
Hi, thanks for the code you replied us. It seems to have fixed the problem of it erroring out, however, by entering that code, we cannot apply any discounts to the item we are trying to add.

To sum it up, the code you gave us let us insert the new item to the customers order, however we cannot override manually the discount given on a particular item.

Right now we may assume that the employee working on this program has left out some key items to make the prorgram complete, but its hard to say since I do not know how exactly he coded this particular portion.

If you have any other suggestions it would be appreciated.
Unfortunately I can give you direction and suggestions but you are the one who have to make it work. I’ll try to give you one more advice:

Try to do this:

[PHP]

Set rsc = CreateObject("a dodb.recordset" )

RestartDiscount :
rsc.Open "select * from products where product_name='" & product_name & "'", strDSN, 3, 1


IF rsc.bof and rsc.eof then
call InsertButtonNam e_click
GoTo RestartDiscount
End if

override = rsc("override") [/PHP]

What I do here call insert command and then redirect code to start discount update all over again. Now it should find newly inserted record and proceed with discount, if of cause I didn't miscalculate it, due to inability to test. It is only my guess.

Good Luck.
Feb 9 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

11
2267
by: mikey_boy | last post by:
Hello! Curious if anyone could give me a hand. I wrote this PHP script with makes a simple connection to a mysql database called firstdb and just pulls back the results and displays on the webpage. Here is the script. I appreciate any light that could be shed on the script and why I would get the errors. Thank you,
2
2429
by: Trev | last post by:
SQL Server 2000 BE, Access 2002 FE. I want to write a stored procedure, that will among other things log errors to a table, I want to be able to report a summary of work done and errors to the user and let them decide whether to commit or rollback. I so far foresee a couple of problems. 1. Inside a transaction, I write to the error log table, will I be able to read it back again before commit/rollback?
10
2349
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a similar name to the table. Rather than making a long Select Case that could become obsolete if lookup tables are added and the source table of the ListBox is edited I came up with this code.) This code works but of course it gives me build...
0
2139
by: doli | last post by:
Hi, I have the following piece of code which iterates through the potential errors: i =0 For Each error_item in myConn.Errors DTSPackageLog.WriteStringToLog myConn.Errors(i).Description DTSPackageLog.WriteStringToLog myConn.Errors(i).NativeError i =i +1 Next
4
9855
by: johnb41 | last post by:
I have a form with a bunch of textboxes. Each text box gets validated with the ErrorProvider. I want the form to process something ONLY when all the textboxes are valid. I found a solution, but it seems like a workaround. I'm not sure if it's the best way: Dim ErrorCounter As Integer Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As
2
1579
by: Samuel R. Neff | last post by:
Within the past few weeks we've been getting a lot of compiler errors in two classes when no errors actually exist. The error always reports as Name '_stepResizeRelocator' is not declared. Where _stepResizeRelocator is an instance (class level) variable. There is no compiler error on the declaration of the variable, only on use. Tthe name of the variable which causes the error changes.
24
5318
by: pat | last post by:
Hi everyone, I've got an exam in c++ in two days and one of the past questions is as follows. Identify 6 syntax and 2 possible runtime errors in this code: class demo {
8
5578
by: ImOk | last post by:
I just have a question about trapping and retrying errors especially file locking or database locks or duplicate key errors. Is there a way after you trap an error to retry the same line that cause the error? In many other languages you have the option of rertying certain errors. In effect, its like a return to the exact same line. You can then retry certain # of times and then produce an error if it keeps failing.
0
5079
by: clemrock | last post by:
Help w/ errors.add_to_base between controller and model Hello, I'm having trouble in routing some errors between model and controller. The errors produced in the controller (invite_controller.rb) are collected and spit out nicely in a flash method as such:
2
1990
by: =?Utf-8?B?UmFuZHlz?= | last post by:
This just started when I updated to sp 1 working on a APS.net, Visual Studio 2008, c# Project. When I open a project, I get tons of Errors showing in the list 300+ if I double click on them I go to the page see the errors with the red squigles and after about 10 seconds they go away. If i do this on on all the pages list I can get down to zero errors. I also found as soon as I hit Publish they go away. The big pain is if I complie and get...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.