New Record For This Contact - Command Button
Sep 7, 2006
Hi all,
I have a database for customer enquiries, and there is one record per product that the customer shows interest in. I want to have a button on the enquiry details form that creates a new enquiry but automatically fills in the contact details from the previous record.
Please also note that I do not wish to "normalize" this so that there is a seperate table for contacts and another for enquiries; it's much easier from our point of view to have the whole enquiry in one record, especially as this is a stand-in database before a fully integrated CRM is implemented. In any case most of the other data (e.g. product, category etc) is already stored in separate tables.
What sort of method do I need to use to create a Command Button that:
-Creates a new record
-Copies and Pastes data from selected fields into the new record?
I tried using the command button wizard for sample code but I got paste errors which were pasted into a new table, and I don't really understand the process of how this works as the Commands are numbers from a list (apparently in the macro window), which I can't find.
I'm using Access 2003 but the database file is in A2000 format. The code is below.
Thank you!
Private Sub ContactAddEnq_Click()
On Error GoTo Err_ContactAddEnq_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Exit_ContactAddEnq_Click:
Exit Sub
Err_ContactAddEnq_Click:
MsgBox Err.Description
Resume Exit_ContactAddEnq_Click
End Sub
View Replies
ADVERTISEMENT
Dec 5, 2013
I am trying to add a command button to my main menu to open the contact names as a datasheet, I have changed the properties on the contact names form to datasheet as well as changing the properties on the button to the below:
Private Sub Command48_Click()
DoCmd.OpenForm "Contact Names", acFormDS
End Sub
at first after I saved it, the button did nothing. Now after a bit of playing around (probably not a good idea) I have a new message that states:"The expression On Click you entered as the event property setting produced the following error: Ambiguous name detected: Contacts_Click.To add some additional information, in the vba sheet above the code i wrote above it says:
Option Compare Database
Private Sub Contacts_Click()
DoCmd.OpenForm "Contact Names", acFormDS
End Sub
Private Sub Contacts_Click()
DoCmd.OpenForm "Contact Names", acFormDS
End Sub
should I delete this?
View 5 Replies
View Related
Feb 21, 2005
Hi all,
In access database project where my tables are linked from MSSQL server, how can I add record from the FORM itself using command button. Bcz it is not like mdb files in access that you can just drag a command button onto the form and take an action like add, delete, print or find rec. I just came to know it from immediate window using following SQL line;
Docmd.RunSql "Insert........
This is ok but how it could be done thru a command button on FORM.
Thanks in advance.
With kind regards,
Ashfaque
View 2 Replies
View Related
Oct 26, 2005
I know you can create a find record command button really simply, which when clicked will display the find and replace window.
What i want to do is create a command button that will search a specific field that i specify in a report for the criteria i enter.
i.e i have a customer information form, which contains
AccountNo
CompanyName
Address
Postcode
Tel etc
what i want is a button that when clicked brings up an input field that allows the user to type the name of the company into this field, then when either the enter key is pressed or another button on this pop up window the matching record will be displayed or a error window stating that there are no matching records. Can anyone help me with this.
View 2 Replies
View Related
May 13, 2006
Hi,
I have a form that contains 2 subforms:
Purchase Order (Supplier, Order Date, Tel etc)
Purchase Order Details (Item Description, Quantity, Price etc)
This way I can have several items in 1 purchase order.
I now need to create a 'New Purchase Order' button. I've tried doing this but it only creates a new record for the form where the button is placed i.e. if the button is in the 'Purchase Order' form a new record is created for Purchase Order but NOT purchase order details.
Is there a way I can get the button to add a new record to 2 forms at the same time?
Thanks
View 1 Replies
View Related
Nov 7, 2004
Hello all:
Code:
Private Sub DeleteRecords_Click()
Dim db As Database
Set db = CurrentDb
db.Execute "Delete * FROM tblJune 2005 applicants;"
End Sub
I am trying to delete all records from a dabase created in access. When I click the command button, I get this message: "User-defined type not defined"
Any suggestion on how to fix this error?
Many thanks in advance,
Dion
View 4 Replies
View Related
Mar 9, 2005
I have two table tbl_Employees and tbl_Femp my users use a form daily and now with help of baxter i'm finishing up on a new one. On my old form it was bounded and with a two step process check box and command button my users would send former employees to the former employees table, well i'm now using an unbound form and with the same script it will select all records and try to move them to the former employees table. here is my code:
Code:DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70Exit_saverecordcommand_Click: DoCmd.RunSQL "INSERT INTO tbl_Femp(FempID, FempLast, FempFirst, FempAdd, FempCity, FempZip, FempHomePhone, FempSSN, FempDOB, FempRank, FempRetCategory, FempComments, FempHireDate, FempRetDate) Select EmpID, EmpLast, EmpFirst, EmpAdd, EmpCity, EmpZip, EmpHomePhone, EmpSSN, EmpDOB, Rank, RetCategory, EmpHireDate, RetDate, RetComments from tbl_Employees where Retiredarchive =Yes"DoCmd.RunSQL "DELETE * from tbl_Employees where RetiredArchive = Yes"
Can some1 please tell me where i'm going wrong? thanks in advance...
View 9 Replies
View Related
Mar 28, 2008
I have set up a work order database. On the Work Order Submission form I have
a command button that adds the record to the table. I also have a button to
email the Submission Report. When the user fills out the form and clicks the
Add button the record is added to the table. The user then has to scroll to
have the record reappear in the form and then click the Email command button.
This works fine but I want to make this a one click operation.
I have a filter on the report that will be emailed to limit the report to just the current
record. The filter is:
[ID] = Forms![WO Submission]![ID]
where ID is the Primary Key for that record. If the record has not yet been
added to the table and thus has no primary key, the report to be emailed
will contain no record info.
I'm thinking I may have to use a temporary table but I'm clueless about how
to make that work.
Any suggestions?
View 1 Replies
View Related
Jul 26, 2015
I am trying to use
RunMenuCommand
command : AddContactFromOutlook
But i get this error message
"The command or action AddFromOutlook isn't available now "
on a demo access "project manager" it works but in my data base does not ...
View 1 Replies
View Related
Oct 6, 2004
Hi All,
I have a form called "frmProducts" which is linking to table "tblproducts".
Easy Enough...
The form shows all the Products information (fields).
I have a "More Info" command button (cmdMoreInfo) next to every record in the form.
When the command button is clicked I would like it to open up another form "frmMoreInfo".
But On frmMoreInfo I would only like it to show that specific product.
I have tried the following code on the on click event on the command button but it was always asking me for the value of Form![frmMoreInfo]![txtInternalCode]
Code:Private Sub Command12_Click()On Error GoTo Err_Command12_ClickDim stDocName As StringDim stLinkCriteria As StringstDocName = "frmMoreInfo" stLinkCriteria = "Form![frmMoreInfo]![txtInternalCode]=" & Me![txtInternalCode]DoCmd.OpenForm stDocName, , , stLinkCriteriaExit_Command12_Click:Exit SubErr_Command12_Click:MsgBox Err.DescriptionResume Exit_Command12_Click End Sub
Any Ideas?
View 4 Replies
View Related
Dec 21, 2004
I would like to develop a command button that archives the current record displayed in the form - my intent is to move that record from one table to another - a sort of automatic cut and paste from one table to another...can anyone help???
View 4 Replies
View Related
Dec 7, 2012
I have have a form with 4 subforms in it, one of the subforms is based on a filtered query . For a reason I can not work out I cannot get it to requery when I add a new record.
To add a new record I select from a combo box and use a command button to save the record
I have tried using this in the buttons on click event
Code:
Forms.trialcatalogueF!TrialCompetitorsSF!competitorsSF.Form.Requery
with no result, however it does kinda work in the combo's after update event, just not until I select another value.
View 2 Replies
View Related
Sep 30, 2014
I have a form named CORRES_TYP with 3 text boxes and a list box. I also have a separate table with 3 field from where the information I put in the form was saved.
In my form whenever I put information on the textbox at hit add record button, these information are saved in my table and will reflect on the listbox on my form below the textboxes. Also if I select a record in the Listbox the record I selected will apprear on the corresponding textbox in the same form.
My problem is that I have been trying to create a command button that will save and change the existing record everytime I select an item in the list box and modify the information through the textbox. Here are some infromation about my table and form:
Table name = CORRES_TYP
Field 1 = CODE (Primary key, No Duplicates)
Field 2 = DESCRIPTION
Field 3 = FOLDER
Form name = CORRES_TYP
Textbox 1 = CODE
Textbox 2 = DESCRIPTION
Textbox 3 = FOLDER
Listbox name = LIST14
View 9 Replies
View Related
Jan 15, 2014
I have created Command buttons on forms with VBA code. Records GoTo previous and GoTo Next Record so both of working is good. But Next Record command is force to a new record. If suppose when we clicking on last record. It is go to new record without any message. So No need to force a new record with Next Record Command. Only just move to next record if there is no records show a message. Below mentioned both VBA codes so there is any changes on GoTo Next Record Code?
VBA Code:
Go To Previous Record : DoCmd.GoToRecord , , acPrevious
Go To Next Record : DoCmd.GoToRecord , , acNext
View 4 Replies
View Related
Nov 5, 2013
I am designing a database to manage hospital patient data. I will have to enter info at various points, e.g. when a patient is referred, admitted, discharged...
So for example, I have a main form with the patient's name and two subforms, one with the referral details (e.g. date, name of referrer...), and one with the admission details (e.g. date, diagnosis). They are linked through Parent-child links to the main form by PatientID. So, when I enter a new PatientID in the main form, the ID in the subforms is automatically added/synchronized.
However, I would like it not to be...since not all patients that are referred are then admitted. Therefore I would like to have a command button in the main Form that allows me to control when a new patient record is added to the admission subform. In other words, I would like an "Add a new Record in the admissions subform" button, which then creates a new record, with matching PatientID in the admissions subform (and in the related table). Is this possible???
I have tried using the command button wizard but it either requires a record to be already present in the subform, or it takes me to the first record of the form, and not the matching PatientID one.
View 7 Replies
View Related
Mar 13, 2012
Is there a way to create a new record by clicking a command button but to show the same text boxes shown in the attachment in the next record.
View 1 Replies
View Related
Jan 13, 2014
I've rebooted my copy record button and just used the macro wizard for now, it seems to work as far as I can tell but there is something strange about it.
I've added in some text boxes so I've got some confirmation, but when I click this copy button I get the following error;
"The command or action 'RecordsGoToNew' isn't available now."
View 1 Replies
View Related
Jun 28, 2013
I want to recall a record by it's primary key in a form with a command button
I mean write a primary key in a textbox and press the button then it shows the record.
View 3 Replies
View Related
Dec 3, 2014
I currently have a command button to run the following...
DoCmd.OpenQuery "Credit Card Report", , acAdd
Which is an appended query.
However, I don't want it to add the whole table each time this is pushed but when trying to use...
DoCmd.RunSQL "INSERT INTO [Credit Cards] ([Provider's Name], [Patient Name], [Patient Account Number] ... VALUES ([Provider's Name.Value], [Patient Account Number.Value], [Patient Account Number.Value]"
It doesn't want to add the single record and gives me an error. I'm pretty sure my syntax is wrong but not sure how to correct it.
The fields I want added are ... Provider's Name , Patient Name, Patient Account Number...
View 1 Replies
View Related
Aug 1, 2013
What to do, I have a form that will reset online user of my system the field is yes or no type boolean and i using combo box that will show only online people but my problem is how to reset the yes to no when i choose from the combo box a username I want to logout. I use command button also.
View 1 Replies
View Related
Sep 17, 2013
I have a form which displays some product details and a stock level. The subform below it allows entry of a quantity to issue and a control button to run a small macro, write a movement record to a stock movement table and then close the form. This works fine.
But the user can also cause the movement record to be written just by keying in a quantity and tabbing out. If this is done several times it writes several movement records and doesn't close the form. I want to ensure that record is only written when the command button is pressed.
Perhaps there is a more conventional or better way of achieving what I want but I can't think of it.
View 2 Replies
View Related
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
Dec 14, 2012
I am on Access 2007, and know very basic stuffs to create tables, queries, and form search. I have just successfully completed a search form filtered with a combobox. Also I have a built-in subform within the main form to display other results as well. The display results are based on one complex query (relational query). Now I need to add a command button that would take me to another form to update the current record found.Quick on the design:
- When I search a subject in a main form(subject lists in the combobox), it would populate results below in the main form and also subform would populate other results as well.
1. Add a command button so can take me to new form, but would need to have the current record populated.
2. Once updated, then how do I save it?
View 13 Replies
View Related
Jun 18, 2013
I have a query that gets it's data from tblContacts. In this table is a yes/no field for archiving and the query gets only those records with a No in the field. The default is no. Next I have a form based on this query, which I am using to hold a set of command buttons which act on a contact chosen from an unbound list. So far so good but now I would like to add a command that changes the contact's status in the archived field of the table to Yes, so that I can use the form to view/edit, or email, or archive.
View 1 Replies
View Related
Dec 19, 2013
Is there a way to disable my print report button if the user has not hit the save button ???? and maybe display a msg box?
attached a snippit of my form.
View 5 Replies
View Related
Apr 18, 2013
I need to open a specific pdf file per record by using a command button. The pdf files will all reside in a specific folder in a partition on my hard drive. Each pdf file will have a unique four digit file name e.g 1234.pdf.The file name will match a unique number allocated to each record. This number is generated by adding 1000 to the record ID.Record 10 will therefore have an associated pdf file name of 1010.pdf.I have created a text box field , named 'TestReportID', to capture the unique four digit number per record that I assume is needed to be referred to when setting up the code to find and display the correct related pdf file.
I have set up a command button on the records form and as simple test using the hyperlink address to the folder where the pdf files reside, I can open a pdf file by clicking on the command button but it does not matter what record is open when I click the command button, it will always open the same pdf file.If I don't identify a specific file name in the hyperlink address, when I click on the button it will display a file open dialog which lists all the relevant pdf files and I can then select and open the required file.I would like to cut out that step and get the correct file to open when I click the button.
View 2 Replies
View Related