Deleting And Adding From A List

Aug 9, 2005

I have a form that has a list; the list is retrieving some names from a table.

e.g

Table name is “ITname”
and I have a filed named “name” with the following: john, peter, mike, rock.

On my form under my list I have a delete button, I want to the button to delete the selected record from the list, how can I do that?

Adding, I also have a textbox and a button which will add a new IT which is inserted in the textbox, how can I do that?

Any help will be appreciated.

Thanks.

View Replies


ADVERTISEMENT

Adding And Deleting To A Table

May 27, 2006

I have a table to which items must be added and others must be removed. Items in the table must be numbered consecutively At present I switch from the table to a query and manually reset the reqirements in the criteria section for each alteration. Can I set up a Query, Update query or something similar so the when I add or delete an Item the numbers field automatically renumbers the rest of the field. If this is understood. Thanks to anyone who can help.

View 6 Replies View Related

Problem With Adding Deleting Records In Bounded

Jun 23, 2005

Hi guys i a have bounded form that supposed to update/add and delete records from customers table. But it is acting very weried when i try to use it. For example in the pic below it shows my form trying to
add a new record number 8 .

http://i5.photobucket.com/albums/y180/method007/tryingtoaddrecord.jpg

After i added new record and if i press the button to bring me to first record i see my new record added to begining of list and if i press button to take me to last record which is number 8 it shows its customername value as blank! I be happy if some one help me fixt this strange problem. Also the first record in the db get delete with new record!

http://i5.photobucket.com/albums/y180/method007/beforeaddingrecords1.jpg ( value in table customer before adding new record)


http://i5.photobucket.com/albums/y180/method007/lastrecordshowsblank2.jpg


http://i5.photobucket.com/albums/y180/method007/afteraddingnewrecord3.jpg ( vlaus in table customer after adding new record .first record get deleted with out my intention!)

Now if i try to delete a record. should i number all the records or not ? I be happy if some one show me how to solve this problem as well.Thanks

http://i5.photobucket.com/albums/y180/method007/beforedeleting4.jpg ( values of customer table before deleting record)


http://i5.photobucket.com/albums/y180/method007/afterdeleting5.jpg

(values of customer table after deleting records)
-----------------------------------------------------------
my code
[code]


''' code for adding new record . This part run when the button is clicked

Private Sub Command14_Click()

If DCount("*", "Customer") = 0 Then
Me.customerno = 1
Else
Me.customerno = DMax("Customerno", "Customer") + 1
Me.customerName.Value = " "
End If


End Sub


'''' this part delets the current record
Private Sub cmdDelete_Click()

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End Sub



[code]

View 2 Replies View Related

Deleting Recordes With Use Of List Box

Apr 22, 2006

hello
i have an unbound form with list box to select recordes to delete i'm have a problem in deleting recordes
here is what i wrote.

For I = 0 To Me.choose_Po.ListCount - 1
If Me.choose_Po.Selected(I) Then
sql = "DELETE press_orders.*, press_orders.ior_no, press_orders.pre_no'FROM press_orders"
sql = sql & " WHERE (((press_orders.ior_no)=[forms]![io]![ior_no])"
sql = sql & "AND ((press_orders.pre_no)=[forms]![delete_po]![choose_po]));"
End If
Next I

View 3 Replies View Related

Modules & VBA :: MDB File - Deleting Multiple Items In List At Once

May 28, 2014

In appendix is .mdb file with this thema.

Inside you can find one form with listbox (with multi selecting ability).

I use this code :

Dim strSQL As String
Dim i As Variant
With Me.se1
For Each i In .ItemsSelected
SQL = "DELETE '*' FROM [t1] WHERE [id] = " & .ItemData(i) & " ;"
CurrentDb.Execute (SQL)
Next
End With
Me.se1.Requery

Result is this one :
1) If I delete only one item in list, it is ok. I can do it again and again and it is working fine.

BUT

2) If I delete more items in list at once, it is ok - but if I will try to do it again then there is an error because .ItemData(i) value is Null.

View 10 Replies View Related

Modules & VBA :: Deleting Values From A Table Selected From A List Box

Mar 19, 2014

Im trying to delete values from a table based on the selected values of a listbox. The listbox values have a hidden column which related to the ID on the table to which I am trying to delete from (if that makes sense).

If I use the following code:

Code:
Set ctl = Me.Results_listbox
For Each varItem In ctl.ItemSelected
CurrentDb.Execute "Delete * FROM Table1 WHERE Table1.ID = " & ctl.ItemData(varItem)
Next varItem

I get an error stating Object doesn't support this property or method.

View 7 Replies View Related

Combo Box - Adding Further Info - Not In List

Dec 6, 2006

Does anyone know of a way to allow a user to add further info to another field on the same record that's created by a combo box that is using the Not In List method?

Dim strsql As String
Dim i As Integer
Dim Msg As String

'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub

Msg = "'" & NewData & "' is not in the list of Callers names." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"

i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Caller...")
If i = vbYes Then
strsql = "Insert Into tblCallersName([CallersName]) values ('" & NewData & "')"
CurrentDb.Execute strsql, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

I need to log a persons name & phone number without having to re enter it again the next time.

To log the name I use a combo box that lists all the previously added names & it also allows you to add further details if the name does not already exist

I now need to work out how to also add the phone number without having to manually go into the names table to add it in.

If anyone understands what I'm talking about then you're halfway there :D

See attached db



thanks

View 2 Replies View Related

Adding List Option Automatically

Aug 7, 2006

This is probably something already talked about, but if i have a combo box that has an "Add New Entry" selection in it, and when the user clicks on it, i want to add what they want in to the table that the combo box chooses from. can I have that "Add New Entry" selection open a form with a text box, and then have that value enter into the table? What is the easiest way to do this?

View 3 Replies View Related

Adding Items To List Boxes

Oct 4, 2006

This is a somewhat complicated question to explain, so please bare with me.

I have a form with a ‘list box.’ The box is populated using a Table/Query Row Source Type method. The table I am grabbing the list from is “Department,” where it contains a list of my company’s departments(ie. Accounting, HR, Payroll, etc.).

Now, the only thing this table does not have is the word “ALL.” I need this word in the “List Box” because I want users to have the option to select ALL.

Is there anything in VBScript code wise or in Row Source that I can do to include this word?

I know I can manually go into the Department table to simply add the word, but this is not the point, because there is more to that(I have different list boxes that are grabbing lists from different tables, AND I have to refresh these tables twice a week). Please help.

Thank you.

Joe

View 1 Replies View Related

Adding A Horizontal Scroll Bar To A List Box

Aug 25, 2004

How do you add a horizontal scroll bar to a list box?

View 1 Replies View Related

Adding Horizontal Scroll Bar To List Box

Sep 3, 2004

How do you add a horizontal scroll bar to a list box? I know that access will add a horizontal scroll bar when neccessary, but it will not add one to my list box. Is there a way to manually add one?

View 3 Replies View Related

Forms :: Form For Adding When Not On List

Nov 26, 2013

I have a table Department

ID
DEPARTMENT
DEPARTMENT_EXPLINATION

I have a table Employee_Listing..This table includes:

Employee_ID (Primary Key)
LAST_NAME
FIRST_NAME
INITIALS

I have a table DISCREPANCY_LIST..This table includes:

DATE (Auto completes to current date)
EMPLOYEE_ID (Primary Key) (Brought over from Employee_Listing via form when initials are entered on form)
LAST_NAME (Brought over from Employee_Listing via form when initials are entered on form)
FIRST_NAME (Brought over from Employee_Listing via form when initials are entered on form)
INITIALS
DEPARTMENT
NUMBER_OF_UNITS
NUMBER_OF_DESCREPANCIES
NUMBER_OF_OK_UNITS

I have a form - DISCREPANCY_LIST..This form enters information into the DISCREPANCY_LIST table.The initials combo box is set: Limit to List Yes and Allow Value List Edits No If the user enters initials that are not stored in the Employee_Listing table they receive an error. Instead of an error I would like for them to receive a message asking if they would like to add these initials to the Employee_Listing table.If the user clicks Yes, then it will bring up the Employee_Listing form.If the user clicks No, then they are told to enter valid initials.

View 1 Replies View Related

Forms :: Adding New Item To List Box

Apr 14, 2013

I have a list box on a form and I would like the user to have the possibility to add another item not from the list into the table using a command button. How can I do that?

View 11 Replies View Related

Adding A Record To A Table From A Field List?

Mar 1, 2007

Hi,

I have a table that has records added to it using the following VBa code:


Const MyTable As String = "tblSampleSubmission"
Const MyField As String = "SampleName"
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim intCounter As Double
Dim LastDub As Double
Dim addString As String
Set db = CurrentDb
Set rs = db.OpenRecordset(MyTable)
Randomize
'LastDub = Me.txtStartValue - Was only used to start the random function later in series
addString = ""
For intCounter = Me.TxtStartValue To Me.txtEndValue
rs.AddNew
rs.Fields(MyField) = Me.SamPre & intCounter & Me.SamSuf & addString
rs.Fields("SubmissionNumber") = Me.SubNum
rs.Fields("CustomerID") = Me.CustomerID
rs.Fields("SamplePrep") = Me.SamplePrep
rs.Fields("Fusion") = Me.Fusion
rs.Fields("XRF") = Me.XRF
rs.Fields("LOI") = Me.LOI
rs.Fields("Sizing") = Me.Sizing
rs.Fields("Moisture") = Me.Moisture
rs.Update
addString = ""
If Rnd < 0.02 Then
'LastDub = intCounter
intCounter = intCounter - 1
addString = " DUP"
End If
Next intCounter
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing

DoCmd.SetWarnings False
Dim stDocName As String

stDocName = "mroLOIAppend"
DoCmd.RunMacro stDocName

Exit_EnterBlast_Click:
Exit Sub

Err_EnterBlast_Click:
MsgBox Err.Description
Resume Exit_EnterBlast_Click




End Sub


What I would hope to be able to do is add a "standard" randomly to each SubmssionNumber (each SubmissionNumber might be 1-100 records). The record I need to add should be chosen at random from a list of 6 or so options and added at the end or middle or start of the job (SubmissionNumber) is this something that is easy to do or should I just give up and add it manually?

Thanks to everyone who has helped me in the past, it is getting me up to speed quickly. Access seems to be quite popular as I have contacted 3 developers to help with my dB but they are all to busy to help me so I am going it alone.

View 3 Replies View Related

General :: Adding Priority List To Database

Feb 20, 2013

I have been asked if I can add a priority list to my database and I am trying to figure out how to do it.

The database already exists and this would be added code/forms. Basically this database has a number of users, all identified by a login name. Each of these users have several projects assigned to them. The projects are identified by a unique project number.

What I need to do is to be able to list all the projects that a user has, which is easy to do by simply creating a query, but then the user needs to be able to type in a priority number (1 to infinity) for each of these projects with no number repetitions. If a project priority is updated, say from 6 to 2, then the projects that had priorities 2 to 5, get a +1 added to their priority number so they go 3 to 6. Likewise if a project gets "demoted" (priority is lowered) then the ones below go up one.

View 1 Replies View Related

Adding Text Option In Lookup List

Jul 20, 2013

I was checking if it is possible to add a text option after creating Look Up Tables, and I am also getting extra spaces while creating lookup tables where the drop down list goes more than 100 items.

View 2 Replies View Related

Modules & VBA :: Adding Data From List Box To Database One At A Time

Sep 12, 2013

how do you loop through and insert selected data from a listbox on at a time?For example, lets say you have an insert statement that has a firstname, lastname, CarsID(foreign key) and address field. Lets say you had another table that has ID and CarsID(primary key) field. In the listbox, you have populated it with all the cars and they are selected.

Example:

INSERT INTO PEOPLE(firstname, lastname, CarsID) VALUES('John','Smith','Honda')
INSERT INTO PEOPLE(firstname, lastname, CarsID) VALUES('John','Smith','FORD')

View 2 Replies View Related

Forms :: Adding Key Value Pair In Combo Box Using RowSourceType As Value List

Jun 20, 2013

I am creating a form in access. In the form there is a combobox in which I am adding items using RowSourceType as Value list and Row Source as Male;Female. What I require is whether there is some way so that when I select Male from combo box M is stored in database and with Female F is stored. I know how to achieve this with RowSourceType as Table/Query but not with RowSourceType as Value List.

View 1 Replies View Related

Modules & VBA :: Adding Image - How To Use Continuous Subform Instead Of List Box

Aug 15, 2013

I would like to add image to list box but i read somewhere i have to use continuous sub form instead.

Now i like to know in sub form also we can select multi items and it shows highlighted entire of each row and easily getting value if selected items.

View 4 Replies View Related

Adding List Box To Display Multiple Hyperlinks Per Record

Jul 24, 2014

I have a table which contains a number of records, each with a load of different columns. However, the new way of doing H&S splits Risk Assessments into Short and Long COSHH forms. Each experiment only has one Short form, but can have from 0-20 (or more Long). I need a way of adding a box to the form that will return all the associated Long forms for that particular record. I have tried using List Boxes and Combo boxes as well as creating a separate table for the Long Forms, but it isn't doing what I had envisioned.

List boxes appear to do what I want, however they just dump all of the results from the selected columns into the table. I only want the data for the specific record in question. For example, my first record has 6 Long forms, but a list box basically just pusts a snapshot of the table in there rather than the specific results.

All the Short and Long Forms have to be hyperlinked to the associated documents. I have successfully done this for the Short.

View 13 Replies View Related

Tables :: Adding More Data In List Sorted In Numerical Order

Sep 27, 2012

I have a list of 22 soccer players with their weights sorted from heaviest to lightest in numerical order. I want to add further players and have the list reflect their standing each time it changes i.e. Col 1 Player ID, Col2 FirstName, Col 2 SecondName, Col 3 Mass:90 Kgs Col 4 Position In group: 1

A new player registers and is 95Kg.....he becomes #1 and the rest go down etc. Can this be done?

View 6 Replies View Related

Deleting Records That Have Been Checked Or Adding A Record After A Checked Record

Jul 20, 2005

Hi,

I was wondering how to delete records that have been checked (through a checkbox) in a form...

Also, I want to add a record after the record that has been checked. I only want this ability to add records available if only one record is checked. Otherwise, if more than one record is checked, the "Add Record" button would be disabled.

Any help would be much appreciated.

TIA.

View 10 Replies View Related

Deleting All Related Sub Records When Deleting The "main" Record.

Apr 12, 2008

I have two tables.

1. Persons (list of persons)
2. Job history (list of jobs)

each person have their own job history. all these jobs are stored in the job history table. when i delete a person i would like the job history for this person deleted as well. each job stored in the job table have a field with person name, so that it is linked to this person.

how can i do this? vba or simple properties options?

- Roy

View 1 Replies View Related

Deleting

Feb 21, 2005

I have a problem about deleting record from a form, it will be grateful if anyone can help me with this.

Here are my tables:
Par_tor: some personal details such as ID, name, phone NO., etc
Par_tion: the record of who has participated which activities.
Activity: name of the activity.

My problem is: the main form of the my form contains the stuffs in table Par_tor, and the subform contains the stuffs in Par_tion, so the user can view these participator's details and the activities they have participated.

In the main form, I also wanted to created a delete button to delete an entire record (including a participator's detail + his/her participation record) at once, but it didn't work since the participation was in the Par_tion table not in the Par_tor.

So is there any way that I can delete these records at once?

View 4 Replies View Related

Queries :: Using Variable In A List Field Query - Getting Complete List On Initial View

Mar 28, 2014

In my access form I provide the user a list of locations from various countries in a listbox . But the list is too long so I provide him a combobox for selecting a country. Selecting the country should update the listbox showing only the locations in that specific country.

So my SELECT from the listbox must cover the unselected state and show all entries and when a country is selected it must narrow the selection.

I tried to get this happen with the following SELECT statement containing a variable. Choosing a country in the Combobox results in a change of the variable and in a requery. This works after the first country is selected and for each country change, but the initial list is empty.

VBA in the loadform
'Application.TempVars.Add "varcountryselect", "*"
SELECT in the listbox "lstlocationsperproject"
SELECT tbllocations.locationID, tbllocations.country, tbllocations.localstreet, tbllocations.localcity FROM tbllocations WHERE ((tbllocations.country) Like [TempVar]![varcountryselect]);

VBA in the combobox
Application.TempVars("varcountryselect") = [Form]![kombcountryselect].Column(0)
Me.lstlocationsperproject.Requery

The values in [kombcountryselect].Column(0) are texts like "SPAIN", "MEXICO", etc.

Any hints, how I have to use the * for getting the complete list on the initial view ?

View 5 Replies View Related

Create A Randomise List From A Table And Save The List For Each Month

Dec 14, 2006

Hi All a newbie here so any help will be appreciated,

sorry for the long post but trying to give you all the information you might need.

I wrote a basic access database for my Church to aid in a paperwork audit for a charity food drop which we do monthly to give free food to the needy.

But each month it gets harder to find out who was in line first so I thought with all your help we may be able to randomize the names each month in a different order as to avoid confusion and also avoid people waiting in line as they turn up at 5am and we don't start until 9am.

So if this will work in access they can all come for 9am

I don't mind creating a new database and adding the additional information, if that's what it would take.

My Background I have created basic databases from scratch not using wizards, But I don't know much about code or how to implement it so any help in where code goes it would be very much appreciated.

Database details (Microsoft Access 2002 version)

Table Name = details
Field name = ID (auto-generated)
Field name = FirstName (text)
Field name = Surname (text)

If possible it would be nice to keep a record of the randomized lists (in the database somewhere ?) each month in case anyone wants to see it or disputes the lists, where I can just create a report to show the details.

There will be approximately 90 to 125 names.

Thank you in advance for all your help in this matter

Britgent

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved