473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Adding and deleting records based on a checkbox

Hi all,

I'm new to this so please be a little bit patient with me :-)

I have the following problem of which I thought i could solve it easily.... But I'm sad to say I can't find the solution. And I have been going at it for a few days now.....

I have a form with a few checkboxes and a table with fields ID=counter, buro=number and dienst=number.
When the box on the form is checked a record should be added to the table (for example buro=2 and dienst=5) and when the box is unchecked this record should be deleted.

Can someone please help me with this because I seem to be going around in circels....

I would be very thankfull for any help.....

Marcel
Nov 8 '08 #1
2 5391
please try the logic below:

Expand|Select|Wrap|Line Numbers
  1. If CheckBox.Value = 0 Then
  2.     str_sql = "Delete from table where field1 = " & buro & " and field2 = " & dienst
  3. Else
  4.     If CheckBox = -1 Then
  5.         str_sql = "Insert into table(field1, field2) values(" & buro & ", " & dienst & ")"
  6.     End If
  7. End If
  8.  
  9. Docmd.RunSQL str_sql
  10.  
  11.  
Nov 11 '08 #2
This works like a charm....
I am a happy person.
Thank you so much for your help.
Nov 12 '08 #3

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

Similar topics

2
by: cool_dude7244 | last post by:
I am retrieving records for Customer ID as follows and displaying them as table rows with a checkbox for multiple deletion. Part of a </FORM>...
8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
1
by: mellie | last post by:
Hi there, SQL 2000 database with ASP I've found many things "out there" regarding updating and deleting multiple records with checkboxes but I can't seem to find anything about adding them. ...
2
by: Johan | last post by:
I have a table1 with a 1 to many relationship to table2. How can I, scrolling on a form based on table1, with subform based on table2, delete the active record and make also that the related...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
4
by: Darrel | last post by:
I'm creating a table that contains multiple records pulled out of the database. I'm building the table myself and passing it to the page since the table needs to be fairly customized (ie, a...
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
3
by: DD | last post by:
Hi, I have an Access DB, for which I have created a form. On the form I have a checkbox control. I would like to create a button on my form that would clear the check from the checkbox for all...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
4
by: ITCraze | last post by:
Hello everyone, I have a Gridview , whose first column is template colums which contains checkboxes , outside my GridView I a have a delete button. So in this application,when the user check...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.