I am developing a Address Book Database Project using Visual Basic 6...
When i click the delete button the data does'nt get deleted in the FrontEnd ..But it gets deleted in Database when we see in Access...
When i try to delete again in VB front End it gives a Error message and it gets
RUN time Error 3021
Either BOF or EOF is true,or current record has been deleted..Requested operation requires a current Record...
I am POSting the Entire Program below..Please Solve my Error -
Dim intCurrAddress As Integer
-
Dim intSaveupdate As Integer
-
-
-
Private Sub LoadAddresses()
-
Dim dbAddress As New ADODB.Connection
-
Dim rsAddress As New ADODB.Recordset
-
dbAddress.Open "dsn=Address"
-
cboAddresses.Clear
-
-
Set rsAddress = dbAddress.Execute("select * from" & _
-
" address order by txtLastName")
-
intCurrAddress = rsAddress("idAddress")
-
Do Until rsAddress.EOF
-
cboAddresses.AddItem rsAddress("txtFirstName") & " " & rsAddress("txtLastName")
-
cboAddresses.ItemData(cboAddresses.NewIndex) = rsAddress("idAddress")
-
rsAddress.MoveNext
-
Loop
-
dbAddress.Close
-
intSaveupdate = 0
-
cboAddresses.ListIndex = 0
-
-
End Sub
-
-
Private Sub cboAddresses_click()
-
Dim dbAddress As New ADODB.Connection
-
Dim rsAddress As New ADODB.Recordset
-
dbAddress.Open "dsn=Address"
-
-
If intSaveupdate = 1 Then
-
SQL = "update address set " & _
-
"txtFirstName ='" & TxtFirstName.Text & "'," & _
-
"txtLastName ='" & TxtLastName.Text & "'," & _
-
"txtAddress ='" & TxtAddress.Text & "'," & _
-
"txtCity ='" & TxtCity.Text & "'," & _
-
"txtState ='" & TxtState.Text & "'," & _
-
"txtZipCode ='" & TxtZipCode.Text & "'," & _
-
"txtPhone ='" & TxtPhone.Text & "'," & _
-
"txtFax ='" & TxtFax.Text & "' where idaddress= " & intCurrAddress
-
dbAddress.Execute SQL
-
End If
-
intCurrAddress = cboAddresses.ItemData(cboAddresses.ListIndex)
-
Set rsAddress = dbAddress.Execute("select * " & "from address where idAddress= " & intCurrAddress)
-
-
LblIdAddress.Caption = rsAddress("idAddress")
-
TxtFirstName.Text = rsAddress("txtFirstName")
-
TxtLastName.Text = rsAddress("txtLastName")
-
TxtAddress.Text = rsAddress("txtCity")
-
TxtCity.Text = rsAddress("txtCity")
-
TxtState.Text = rsAddress("txtState")
-
TxtZipCode.Text = rsAddress("txtZipCode")
-
TxtPhone.Text = rsAddress("txtPhone")
-
TxtFax.Text = rsAddress("txtFax")
-
dbAddress.Close
-
End Sub
-
-
Private Sub CmdAdd_Click()
-
CmdCancel.Enabled = True
-
Cmdupdate.Enabled = True
-
CmdAdd.Enabled = False
-
cboAddresses.Enabled = False
-
CmdAddress.Enabled = False
-
-
LblIdAddress.Caption = " "
-
TxtFirstName.Text = " "
-
TxtLastName.Text = " "
-
TxtAddress.Text = " "
-
TxtCity.Text = " "
-
TxtState.Text = " "
-
TxtZipCode.Text = " "
-
TxtPhone.Text = " "
-
TxtFax.Text = " "
-
intSaveupdate = 0
-
End Sub
-
Private Sub CmdAddress_Click()
-
rptAddress.Show
-
End Sub
-
Private Sub cmdupdate_click()
-
Dim dbAddress As New ADODB.Connection
-
Dim rsAddress As New ADODB.Recordset
-
Cmdupdate.Enabled = False
-
CmdAdd.Enabled = True
-
cboAddresses.Enabled = True
-
CmdAddress.Enabled = False
-
dbAddress.Open "dsn=address"
-
SQL = " insert into address(txtFirstName,txtLastName," & _
-
"txtAddress," & _
-
"txtCity,txtState,txtZipCode,txtPhone,txtFax)" & _
-
" Values(' " & _
-
TxtFirstName.Text & " ', ' " & _
-
TxtLastName.Text & " ', ' " & _
-
TxtAddress.Text & " ', ' " & _
-
TxtCity.Text & " ', ' " & _
-
TxtState.Text & " ', ' " & _
-
TxtZipCode.Text & " ', ' " & _
-
TxtPhone.Text & " ', ' " & _
-
TxtFax.Text & " ')"
-
dbAddress.Execute SQL
-
dbAddress.Close
-
LoadAddresses
-
End Sub
-
Private Sub cmddelete_click()
-
Dim dbAddress As New ADODB.Connection
-
Dim intResponse As Integer
-
strResponse = MsgBox("Are You Sure?", vbYesNo, "Delete Query")
-
If strResponse = 6 Then
-
dbAddress.Open "dsn=address"
-
SQL = "delete from address where idaddress= " & intCurrAddress
-
dbAddress.Execute SQL
-
LoadAddresses
-
-
dbAddress.Close
-
End If
-
-
End Sub
-
-
-
Private Sub cmdcancel_click()
-
LoadAddresses
-
cboAddresses.Enabled = True
-
CmdAdd.Enabled = True
-
Cmdupdate.Enabled = False
-
CmdCancel.Enabled = False
-
End Sub
-
-
-
Private Sub Form_load()
-
LoadAddresses
-
End Sub
-
0 1894 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ken |
last post by:
Hi.
Can anyone refer me to any articles about the compatibility between
c++ polymorphism and real-time programming?
I'm currently on a real-time c++ project, and we're having a
discussion...
|
by: Carmine Cairo |
last post by:
Hi,
I'm working on a project and today I've note a little problem during the
compile fase.
Here a little piece of code:
// 1st version
welldone = 0;
size = p->getSize();
backbone = new...
|
by: cab0san |
last post by:
I downloaded the DB2 runtime client, but the Client Base support and
the TCP protocol do not install. I re-run the setup select them to run
from disk, and they still show as not installed. What am...
|
by: Mike MacSween |
last post by:
Some of my users are getting 'Disk or Network Errors'. I've raised it with
the network admins, they're looking into it.
In the meantime...
My 'standard' error handlers logs errors to a table...
|
by: MLH |
last post by:
I want to change my system time date each time an A97 app is
started. Here's how I've been doing it. Am looking for a better
way. Sure some of you have researched this.
Function...
|
by: Glen |
last post by:
I'm working on a custom assembly and I'm trying to figure out the best
approach to handling known constraints within the assembly, once
compiled, to alert the developer at compile time of a...
|
by: Alfonso Morra |
last post by:
Hi I'm compiling some code and need to generate some random numbers. To
save time, I decided to use the srand, rand and time functions.
My code worked (atleast built fine) until I added time.h,...
|
by: rdemyan via AccessMonster.com |
last post by:
Is there a way to get the internet date/time. I saw an article that uses
WinSock, but WinSock doesn't seem to be available in Access.
I want to verify that the date/time on the local PC running...
|
by: ThunderMusic |
last post by:
Hi,
I'd like to create a compile time error in my class... maybe there's a way
already built in in the framework so I can achieve what I want... I have 2
constructors in my class. One of them...
|
by: ahmurad |
last post by:
Dear Xperts,
In my database table some fault code type records are inserted and the values are like bellows:
Error:2/FC:10; 00:15:13 16/03/2009;
Error:2/FC:20; 00:15:15 16/03/2009; ...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
| |