473,698 Members | 2,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Two Access Questions - Entering and Deleting Data

I have two questions:

1) Say I have a form bound to a table. Assume the user is entering
data into a new record at the bottom of the form. Now, suppose the
user clicks a button on the form while he's still entering data and
hasn't yet saved the record that he is modifying. How can the
button's click event procedure test to know that the user is in the
middle of entering new data? I've tried testing against the form's
recordset's AbsolutePositio n, BOF, and EOF with no luck.

2) How can one do in code exactly what the DEL key does on a form?
The DEL key on a form allows you, among other things, to delete a
modified record such as the one describe in my first question. Using
the recordset's Delete method doesn't do this. How would one write
an event procedure for a button that does exactly what the DEL key
does when used in a form?

Thanks.
Dec 7 '07 #1
2 1692
One trick would be to use an Unbound Form. Add data to this form which
would have unbound textboxes and a button for new record (and/or buttons
for movenext, moveprev) then then when you move to a new record or any
other record
-- that would trigger a statement like

DoCmd.RunSql "Insert Into tblx(fld1, fld2, fld...) Select txt1, txt2,
txt..."
You can also have your own delete button which would just clear out the
textboxes (because you have not yet added the data to the table). Or if
the data is already in the table and you want to remove a record then:

DoCmd.RunSql "Delete * From tblx Where RowID = " & txtRowID

Another thing you could do for deleting a record(s) if the form is a
bound form is to view your form in datasheet view and select a record
and just press the Delete key. Go to the view menu at the top of Access
and select Datasheet View
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Dec 7 '07 #2
I have two questions:

(1)

If Me.Dirty Then
'Do your thing here if in the middle of a new record
End If

(2)
Me.Undo

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

Dec 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1931
by: Mark | last post by:
Not sure this is the right place for this questions, but here goes: I get an error message when deleting an table from a Access database. The code is as follows and the error message is after it. ***************** Start Code ******************** <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.Oledb" %>
4
2946
by: Mark | last post by:
Not sure this is the right place for this questions, but here goes: I get an error message when deleting an table from a Access database. The code is as follows and the error message is after it. ***************** Start Code ******************** <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.Oledb" %>
28
4041
by: Lee Rouse | last post by:
Hello all, This is going to be a rather lengthy "question". I have an Access 2k database, separated front end/back end. Front end copies are on about 30 workstations and used frequently during the work day. The backend has a table called CLIENTS with approximately 6000 client records. Changes to data in the table are made via a frontend db Form which has CLIENTS as its record source.
1
9195
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this will work for 9i and even 10g ) No one had what I needed, so I wrote it myself. I Rule. This code isn't going for efficiency, and isn't trying to be dynamic. It doesn't create the table structure in Oracle, that's up to you. (I
49
14340
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The application is relatively big: around 200 tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data (SQL Server 2000), 40 users. I'm wondering what are the disadvantages of using Access as front-end? Other that it's not...
1
1524
by: Mark | last post by:
Not sure this is the right place for this questions, but here goes: I get an error message when deleting an table from a Access database. The code is as follows and the error message is after it. ***************** Start Code ******************** <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.Oledb" %>
22
2218
by: Deano | last post by:
Hi, I have a finished Microsoft Access app that we are distributing using an Access runtime. This works fine (mostly) but I'm sold on the advantages of dot.NET and upgrading to vb.NET seems like a good idea for the future. I'm also keen to develop new software in vb.NET as soon as possible. I will work out how to port the app and how to use ado.NET etc, however I'm not certain about all the things I need to consider hence the...
2
2769
by: Kelly | last post by:
I'm fairly new to ASP.NET2, but I have an ASP 3.0 background, and I've been experimenting with the DataSource and FormView widgets. I wound up having some questions along the way which I hope you all can address to help me understand events with these better. I've been reading up on inserted/inserting also deleted/deleting, but where is it better to run call those events from via formview or datasource? Also, I have been trying to...
6
1677
by: BrianDP | last post by:
I have a table that has always been in my back-end of this application. The table is getting quite large, and, on top of that, we lose records out of this table. They just dissappear! No rhyme or reason to it. I imported the table into SQL, and re-linked it back into the front end of the application. All the fields show. I had to pick a primary key, which is fine, it's a text field (nvarchar 255), and it is indeed a unique value. ...
0
8674
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8603
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
9157
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8861
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7723
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
4366
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3045
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
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.