Modules & VBA :: How To Automatically Delete Information In A Table With A Command

Oct 30, 2013

my database just records end of day sales figures which are entered though a form, after they are entered the total for the day is archived. However the problem i have is that the i need some way of clearing the input table with a command in the form.

View Replies


ADVERTISEMENT

Modules & VBA :: Delete Table Record - Command Button?

Jun 27, 2013

I have created a form and need to be able to delete employees from a table. I built a command button using the wizard and this is the current vb code-

Code:
Private Sub cmdDeleteEmployee_Click()
On Error GoTo Err_cmdDeleteEmployee_Click

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
Exit_cmdDeleteEmployee_Click:
Exit Sub
Err_cmdDeleteEmployee_Click:
MsgBox Err.Description
Resume Exit_cmdDeleteEmployee_Click
End Sub

But when I click on the button I get a message saying it would create duplicate data in the table.

View 13 Replies View Related

Delete Records Automatically Frm Table

Jul 26, 2006

How do you have Access delete records automatically from a temp table?

View 1 Replies View Related

Delete Record From One Table And Have It Automatically Added To Another Table?

Oct 28, 2011

I have an employee and asset database. If an employee gets fired, I need remove them from the general employee records, but I want to save a record of that employee. Is there a way to delete an employee from one table and have it automatically added to another table?

View 4 Replies View Related

Tables :: Delete Item Entered In One Table From Another Automatically

Dec 24, 2013

Im trying to make a basic customer database and pos system. The part iam having trouble with is, I have two tables as follows:

Inventory: orders(invoices):
productId ProductId
amount (in stock) amount(sold)
pricePerUnit CashTendered

I want the amount(in stock) sold in each order to be deducted from the total in the amount(sold) automatically.

View 1 Replies View Related

Modules & VBA :: Command Button To Delete Records In Sub And Main Forms

Jun 24, 2013

I am trying to create a command button that will delete the current records in both the subform and main form.

I know how to create a command button that will delete the current record of which ever form I'm in (either the sub or main form) but I wish to do so both at the same time with one event procedure. I currently have been experimenting with a button in the subform but I don't really care if it's in the subform or main form.

View 2 Replies View Related

Access 2010 - Delete Form Command Button With A Password To Confirm Delete

May 6, 2014

All I am trying to do is insert to have a form with a "Delete Record" button on it. The problem is I don't want anyone to be able to delete a record, I would like someone to have to insert a password to confirm the delete.

View 13 Replies View Related

Modules & VBA :: Unbound Forms Information To Table

Jan 13, 2014

I've tried using the vba to have unbound forms information pasted to a table. The Vendor, Channel and Department are unbound fields in the form and I can't, for the life of me, figure out how to get them to append to the table.

I've tried using solutions provided prior but I must be missing something. Here's my database. I'd like for it to append to the table then ready the form for the next entry.

View 14 Replies View Related

General :: Automatically Add Information After Field Exceeds?

Sep 20, 2012

I have a field "Permit_Date_Expired" field automatically is created by adding one year to the "Permit_Date_Issued" field.

when the "Permit_Date_Expired" field exceeds TODAYS() date I want it to automatically change the field "Permit_Holder" to say Expired is this possible?

View 5 Replies View Related

Modules & VBA :: Copy Record To History Table And Then Delete It From Main Table

Jul 9, 2014

I have a form with a sub form. when a record is choosen in a combo box the sub form is filled out with a record.

what I am trying to do is have a button that will copy that record to a history table then delete it off the the main table.

I cheated by using the wizard to get the code to delete the record but I am having troubles modifying the code to copy that record to the history table. Here is the code below. I have tried to insert code in several places but it just errors out.

'------------------------------------------------------------
' Master_tbl_sub_fm
'
'------------------------------------------------------------
Function Master_tbl_sub_fm()
On Error GoTo Master_tbl_sub_fm_Err
With CodeContextObject
On Error Resume Next

[Code] ....

View 8 Replies View Related

Modules & VBA :: Reading Table Of Information Recordset From XLSX File

Mar 17, 2014

I am trying to use a Connection to an xlsx spredsheet to read in a table of information (the data is not a table, just laid out in a table, see attached, the one I am trying to load is xlsx not xls but I cannot for some reson upload the xlsx one on here)

I have the following declared:

Code:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset

my connection string is:

Code:
strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & cstrFolder &
Chr(92) & tempSymbol & ".xlsx;Extended Properties='Excel 12.0 Xml;HDR=YES';"

I open the connection which works fine:

Code : cn.Open strConnectionString

Now here I hit the problem, I have the following SQL string:

Code : strSelect = "SELECT * from [table$]"

The spreadsheet contains just 1 tab, named table so I think I am referring to the data correctly in my SQL string?

When I open the recordet for variable rs using:

Code : rs.Open strSelect, cn, adOpenStatic, adLockOptimistic, adCmdText

I get the error dialogue box:

The Microsoft Access database engine could not find the object 'table$'. make sure the object exists and that you spell its name and the path name correctly.....

I did a Debug.print to check the strConnectionString was correct and the Source is exactly correct and refers to the name of the file I am trying to access exactly.

View 2 Replies View Related

Forms :: Stock Number - Place Information In A Field Automatically

Feb 7, 2014

I have a stockist which includes " stock number", " description"

When I use these parts to create a "bill of materials" for a job I am presently selecting the material and this data is going into the table and the stock number just goes in the form not the table, is there a way that when I select the "stock number" the material will still go in the table and the stock number stays on the form. or also go into the table

The reason I want to do this is because the stock number is easier to remember than the description ...

View 3 Replies View Related

Automatically Delete Records

Mar 28, 2006

I have 2 forms:
one called basic the other called advance

how can i automatically delete records from the basic table, when students are advance.

thanks 4 helping

View 1 Replies View Related

Delete User Information In System.mdw File?

Jun 15, 2006

Is it possible to delete user information in workgroup information (System.mdw) file from command line or programmatically?

Thanks

View 1 Replies View Related

Field To Automatically Fill With Correct Value Based On Information In Multiple Fields

Apr 16, 2012

I have a database in which we are trying to have a field "Headcount" automatically fill with the correct value based on information in multiple fields. The "Headcount" field will be based on about 6 or 7 rules. Most of the rules i can figure out, but im having trouble figuring out what the best way would be to search for a single individual's projects when they are on more than one project at a time. I thought about using a counter of sorts to count how many projects someone was one, but how do I pick them out of the entire table once i have found out the number of projects? Would a for loop work best or just many if statements?

View 5 Replies View Related

Automatically Delete Data From Certain Fields

May 23, 2005

I have a table in my Database that uses the feilds Location and partnum. I use a barcode scanner to generate each of these fields. The problem I am having is that when our part number is scanned it contains data such as "des--. 123456 --aa". I have been doing a find/replace on this data to remove the "des--." and "--aa" but I was wondering if access has a function to do this for me so that I can get a macro to check automatically for this type of problem. Any ideas?

View 1 Replies View Related

Delete Field Contents Automatically

Oct 14, 2004

Here is one that I could use some help with.

I have an Updates field in all of my tables. It, of course, holds my audit trail. Im tryiing to figure out a way that I could run a single command and clear the contents of all the Updates fields on all the tables in my db. Ideally, I'd like to auto generate a report for all the update fields on all the tables, then do a purge.

Any ideas?

View 4 Replies View Related

Modules & VBA :: Automatically Repeat Last Record Under Certain Conditions In A Table / Query

Jul 15, 2014

I’d like to repeat the last not = 0 record under certain conditions, in a table or in a query.What I have:

Calendar_All Dates
Calendar dateMyValue
7/6/20140.00
7/7/2014108.94
7/8/2014107.71

[code]...

Basically, if Calendar date > Date(), if Calendar Date not Saturday or Sunday, weekday(Calendar date<>1 and <>7), AND Calendar Date not in (Holidays table).Then repeat the last not = 0 value of MyValue. I thought of changing the default value but the value is already 0, while default is null + I need to set the default value under certain conditions.

View 14 Replies View Related

Forms :: Tracking Database - Update Information In Subforms Automatically From Main Form

Jul 6, 2013

I am attempting to create a patient tracking database for a clinic I work in and I am stuck at one small but major part.

I have a parent form called frm_Patient_index. On this form you can enter patient details such as personal details, observations ect. I need to create a lab request form for certain tests to be performed.

I want so that a button on the frm_patient_index form opens a subform where the relevent tests can be requested via tick boxes. Now here is my problem I have managed to create all of that except for the information to be entered into the frm_lab_request automatically and get SAVED to its corresponding table. It will not save for me.

I can get the information such as Badge Number, First Name, Surname and DOB to all enter into the fields automatically but getting them to save to the table is not happening.

View 3 Replies View Related

Modules & VBA :: SQL Statement DELETE With Variable As Table

Aug 14, 2014

I'm trying to run this very very simple code but I get a Run-time error '3450' Syntax error in query. Incomplete query clause. For sure the problem is the variable I used as Table parameter but I cannot understand where my error is :

Private Sub cmdRunCheck_Click()
Dim strSQL As String
Dim strTempTbl As String
strTempTbl = "tblCheckDoubles"
strSQL = "DELETE * FROM " & "'" & strTempTbl & "'"
CurrentDb.Execute strSQL, dbFailOnError
End Sub

What is clear is that if I use this line the Sub is working smoothly

strSQL = "DELETE * FROM tblCheckDoubles"

Please do not tell me that it is not possible to use a variable as Table parameter....

View 8 Replies View Related

Modules & VBA :: ADO - How To Delete Data From Only One Table From A Join

Dec 17, 2013

How to Delete data from only one table from a Join? OR How to set the ADO recordset unique table property?

On Access 2010 module I have a class that manipulate data (save, read, edit and delete) from this statement:

Code:
Private Const strNomeTblFonte as string = _
"SELECT ER.*, ET.intTipoExame, ET.txtNomeExame, FROM tblExamesTipos
ET INNER JOIN tblClientesExamesRequisitados ER ON ET.idExamesTipos = ER.intQualExame;"
Private Sub Class_Initialize()
Set mCol = New Collection

[Code] ....

Problem: I need to delete data from only one table (tblClientesExamesRequisitados) of a inner join, but only delete from the "wrong" (tblExamesTipos) table.

After going to msdn on title: Unique Table, Unique Schema, Unique Catalog Properties-Dynamic (ADO) I attempted to address the problem with this line in the Class_Initialize():

Code:
Recordset.Properties("Unique Table").Value = "tblClientesExamesRequisitados"

But only generates this: Run Time Error 3265 - Item not found in this collection...

I know, if I open another Rst and use a Distinctrow, or open only one table, as in "DELETE * FROM tblClientesExamesRequisitados WHERE intQualExame = " & miQualExame & ";" it will resolve, but, why "Unique Table" isn't functioning?

View 3 Replies View Related

Modules & VBA :: Combobox To Delete Records From Table?

Sep 6, 2013

I have a very simple 2010 Access database with only one table which contains a few fields (username, email, phone....)

I have a combobox with unbound controls to search/find users (by the lastname field). The combobox is in the header section which populates the fields (controls?) in subform below.

I have a delete button with some VBA code which allows the user to delete the currently displayed record however when the form refreshes, I end up with two issues:

1: I see #deleted# in the combobox dropdown until the dbase is closed/reopened (it's only typically used by one person at a time.) Compact/Repair doesn't seem necessary, especially since i think it's pretty difficult to do this programatically (?)

2: There are blank rows in the combobox dropdown from where the data used to reside after deleting the record.

I haven't been able to figure out how to remove those blank rows and refresh the combobox to display the remaining records (with the blank rows removed). So I have dozens of blank rows. Me.Requery doesn't seem to work.

My assumption is that the blank rows exist because I'm deleting the content from the combobox's initial creation?

Is there a better way to allow user's to see the list of user's and then be able to select that record and delete it?

If I use a simple search box on a form where people have to type a (last name for example), if it's spelled incorrectly, then nothing would be found.

View 5 Replies View Related

Modules & VBA :: Query To Delete Records From Table

Jul 22, 2015

I have two tables Table1,Table2. I want to delete records from Table1 whose ID= CoventionalID field value from Table2.

Table1 has two fields (ID,PolicyNumber)

Table2 has 5 fields(ID,PolicyNumber,ConventionalID,Conventional PolNo)

The following query doesn't delete anything.

Code:
DELETE *
FROM Table1 WHERE ID=(Select ConventionalID from Table2);

View 3 Replies View Related

How To Run A Command Prompt Script Automatically From MS Access

Aug 13, 2007

I want to run a Command Prompt instruction. Is it possible to do it pass it from MS Access, not from the Command Prompt Window?

Thanks,

View 1 Replies View Related

Modules & VBA :: Delete And Insert Data From A Table In One Routine

Oct 10, 2013

Access 2010. Can vba code be written to delete and insert data from a table in one routine.

Something like Delete * Insert into select from where order by....

I tried it with a query but have to write two.

View 1 Replies View Related

Modules & VBA :: Delete Records From A Table Using Controls On A Subform

Jun 20, 2013

I have a sub form that allows users to add staff to a project team, once added it populates a table which updates the subform showing the selected employee. I am trying to enable a delete function that allows users to remove an employee from the project team in the subform showing selected staff. Here is the code I have so far, but it doesn't work;

Code:
Private Sub Command4_Click()
Dim dbs As Database
Dim rs As Recordset
Dim sqlstr As String
Set dbs = CurrentDb
sqlstr = "DELETE tbl_CapexStaff.* FROM tbl_CapexStaff WHERE CAP_ID = Forms!frm_Switchboard.CAP_Live"
dbs.Execute (sqlstr)
End Sub

View 4 Replies View Related







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