Modules & VBA :: Copying Value Of Text Box On Another Form
Jun 4, 2015
I'm trying to continue with my rebuild of our call answering screen. It's basically a form with a button for each company we represent, clicking the button will lead to a call answering screen for the company. we also have software that pops the correct screen when we receive a call for the corresponding company.
I'm trying to get some of the fields to autopopulate, starting with the telephone number of the caller. the number appears in a text box on the main form and I'm trying to copy it into the caller telephone box on the call answering form. I've got code in place but it gives me the error "you can't reference a property or method for a control unless the control has the focus". Here's the code for the form I'm working on...
Code:
Option Compare Database
Private Sub cmd_recordcomplete_Click()
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, Me.Name
End Sub
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
txt_dateandtime.Value = Now
Me.txt_callertelephone.Text = Forms!Switchboard!txt_incoming.Text
End Sub
What I'm trying to accomplish is some sort of 'Order Confirmation' (filled with the info i have entered in my order form and sub_form fields) that i can copy and paste as a reply to their email-order.
I have taken 2 failed approaches so far:
1) I used a report to display the info
Private Sub Command103_Click() DoCmd.OpenReport "Order Confirmed", acViewReport, , "OrderID = " & Me!OrderID End Sub
This worked fine until the information was copied and pasted into outlook which upon doing so changed the column titles and layout
2) I used another form with a text box to fill with the data entered on the Order form
I have a form on which there is a series of text box controls relating to different frequencies. At the moment I enter a value in to each of these manually.
However, I would like to have an unbound text box where I can paste in all the values (6 or 8 of them) from excel and then press a button and they would be copied in to the individual boxes.
So far I have my design:
I'm not sure where to start with regard to the code as I don't know how to handle delimited text - is it column delimited in excel?
I imagine some sort of loop, such as a do until will be required but again not sure.
I would like to be able to join 2 text boxes and then copy them to clipboard. My initial fumbling has had me to joing the 2 text boxes as a string and then set that string as the value of another hidden text box and then copy that text box.
This does work but I would like to format the output if possible to remove the element identifiers? The string copies out as below.
Title Information<div>Description Information</div>
Is it possible to remove the <div> and any other elements that may appear either using my method or another way. Not sure if they are appearing as the Title box is plain text and the description is Rich?
hi i am trying to copy emails from a ms access document for work. (there are about 6000 of them) when i go into the data base...under the emails column i see ALL this
åëîõôèÀðáõìèåííåò®ãïí
its just lines of that! if i cant copy all the emails this way, i will have to do 1 at a time with a program and it will take me literally 10 hours
please help i dont wanna get fired lol
how can i copy the emails. In the program, the emails are all normal (you kno....like myemail@here.com) but in the access document, its like that
I need to get an email address from a field and place it onto another form.. HOWEVER I dont want it as a hyperlink, nor do I want the mailto blah blah coming over.. I just want the email address as TEXT.In the application the user opens the email form by clicking an icon on an invoice screen, this will allow them to automatically email to the client.. Once they open the email screen they naturally see an arrangement of other boxes where they can enter subject, email description etc..
At the same time there are two boxes, the "To" box and the"From" box... I want these boxes to be auto updated with the email address (to save time). When the user clicks the icon on the invoice screen it automatically copies and displays the email address of the client in the "To" box on the invoice.. The problem I am having is that it is displaying as useless information which is associated with the hyperlink.The email address comes from a field that has already previously been associated as a hyperlink, and it HAS to come from this field, I have no way around it.... All of this information is coming from an address book section from a field that is a hyperlink field.. If it was a txt field then I would not be having this problem.
As I already have various forms open displaying information I am able to used simple code to fill in various bits of info to save time... Because of this I am using simply code to copy the email address from one form to another:
Forms![Email]![To] = Forms![AddressBook]![Email]
Obviously the above code is simple and works for 90% of this type of approach, however there must be some other code that I need to use to first translate the email address to text...
In the end I don't care what I have to do as long as it works.. Remember though that the original field is a hyperlink field and must remain so, I cannot simply convert that to txt..
I am trying to make use of the OpenForm command to open a form to a record where a textbox matches the value of a text box on another form.
On Form1, I have a textbox called txtRtnRef, and it contains a reference number in a similar format to SWR-9
On Form2, I have a textbox called txtReOrderRef (control source ReOrderRef) which also contains a reference number in the same format (SWR-9)
I am trying to have a button next to the text box on Form1 that has an OnClick Event that opens Form2 to the record containing the same text reference number.I have tried, to no avail, a number of variations of the OpenForm command, the most recent being
I have two tables. TableA and TableB They both have the same columns.
I need a query that will look at the diferences between TableA.Column1 and TableB.Column1 and copy whatever TableB.Column1 is missing from TableA.Column1
So I want it to copy over the entire record based on what TableA.Column1 has the TableB.Column1 does not have.
I'd like to know if it is possible to copy an object (typically forms, reports and queries) by code from the acces file I'm woriking in to another one that is not opened.
I haven't used FSO before, and it seems that the syntax is a little different than typical VBA for strings, but I can't quite figure out what I'm doing wrong here... I keep getting a "file not found" error on the "FSO.CopyFile..." line. I have printed all of my strings to the immediate window to check that they're printing correctly. It all looks good. My code is as follows:
'Copy file 'Set up strings for coding file names Dim FilePath As String FilePath = Me.txt_FilePath Dim FileName As String FileName = Me.txt_FileName
I'm currently working on a database to track and inventory documents in my organization similar to a library catalog, but with a digital archive as well. I'll need the ability to "attach" documents to records in the main inventory (though using links instead of storing it in the db) and have the documents live in a centrally accessible location on our shared server.
I will need to have this function work through a few different tables and in a few different iterations, but I'm trying to work on the simplest part first, which is attaching a thumbnail/preview of a given document to the record for that document.
I've got some VBA working well which opens the file picker and copies the file to a directory relative to the DB. It also creates a folder with each employee's ID number if it doesn't exist already (which it gets from the Windows log in) and adds "Copied_" to the front of the file.
Now I'm trying to get the VBA code to interact with the record. Presumably I need to tell the form button I'm using to launch the VBA code to pass the primary key of the record being displayed to VBA. Then, at the end of the VBA code I need to take that value and find the record again from VBA so I can update the MediaThumbnailLink in the original record.
Does this order of operations make sense? If so, how should I go about passing these values back and forth and writing the new link value?
Here's the VBA I'm using so far...
Code: Option Compare Database Public Sub GoCopyThumbnail() Dim fDialog As FileDialog Set fd = Application.FileDialog(msoFileDialogFilePicker) Dim varFile As Variant Dim LUser As String
I have form named home page in this homepage form in the form header i have inserted some fields from some tables like province, district, community etc. these fields are unbound and are used for filtering purposes, when i select a province all districts related to that province displayed and when i select a a district all related communities displayed, there is a one to many relationship between district table and community table,
What I want is, when i select a district on the form header(it is unbound as i explained before) of this homepage form, the DistrictID should appear in community subform under DistrictID(as there is a one to many relationship between district and community) .
For more clarification find the snap shot attached...
I am a beginner and I am having difficulty doing the following.
I have created a form from a query, (by agent)
The form took a little while to design, and I know how to copy the form, but how do you change the agent that is being referenced without having to go create the whole form layout again.
The answer is probably in here, but I can't find it... so I have two questions.
1) On a form, I have a field with Company Legal Name and Company Trade Name, most cases the company trade name is the same as the legal name. So what I would like to do, is add a button next to the Company Trade Name field so when clicked it would automatically copy the text data from legal name to trade name.
2) Same scenario as above but with mailing and shipping address if it is the same.
I have a form on which I have asubform. This form is based on a query. I would like the user to be able to add/and update information from excel to this form. When I try to copy from Excel and paste them or try to overwrite the eisting data, I get the following error: " You cannot add or change a record because a realted record is required in tabel "benchmark".
Can anybody tell me how to fix this? thank u.. Stacey
I have got a form with our company's representives. This form has a subform with clients certain representives aren't allowed t contact. I would like to have a 2nd sub report with all the customers listed and their addresses with the ability to highlight one or many customers, click a button and have the customer IDs and names update to the first subform. Has anyone done anything like this?
I am currently creating a database which stores customer details and booking details.
I have the following tables: Customers and Reservations, both of which are linked by the CustomerID field.
The customer form automatically assigns a CustomerID when you enter data, however I then want the CustomerID to be copied on to the reservations form aswell. Also, the reservations form is a new form and not a subform.
Hey all, I am wondering if there is a way to copy and past a control from a FORM to a REPORT? I have an activex control for my digital signatures and for some reason the value is not showing up on my report, I have tryed several different ways and I was wondering if there was a way to copy the activex control and on the open of the report the value what was copyed would appear on the report. can this be done? I believe that somehow the value is not staying in the field provided and just going directly to the table therefore I cant see it on the report. Is this possible? Thanks in advance
How do I copy a form from one database that have reports and quaries linked to it to another so that I can change the information in the new database and keep the form style in the old database?
I exported two new forms I created to 2nd database and for some reason ALL the forms I had in the 2nd database were deleted!!! I don't understand why this happened because I have done this before and the forms in my 2nd database were never deleted.How can I get the forms I had in my 2nd database back??
Ok, I'd like to appologise first as I wasn't sure that this question/problem would fit appropriately into the "Forms" forum, and also for the length of this post.
In the database I'm currently building, I have a form that is used for adding new product purchases for a given customer. So far, after much googleing and and head racking, I've managed to get everything in working order, save this one problem I can't solve.
The form uses the following SQL to populate its field list;
SELECT Products.*, [Expense Codes].[Montant de Paquet] FROM [Expense Codes] INNER JOIN Products ON [Expense Codes].[Expense Code ID]=Products.[Expense Code ID] WHERE (((Products.[Commencez Date])>=Date()));
Sorry for the french text, this is for use by a French company
On the form I have a combo box that lists the product packages available (combo 1 for reference), Prod 1, Prod 2 and Prod 3. This is a field in the products table which is linked to a seperate table called Expence Codes. This table holds my master list of product codes, and their off the shelf price in a field called 'price'. By using the above SQL, I have the price field ("field 1" for reference) on my form auto update when ever the value combo 1 changes. This is working as I would like it to.
Now for the issue I'm having. I would like to take the value from field 1 to be copied to a field in my payments table, this is to facilitate a final billing value being correctly calculated and invoice being created. However, I'm at a loss as to how to acomplish this.
I have thought of using an update query to add this information to the payments table, as the relivent record will already be created, but Im not sure if this is the right way to go. So any ideas on what I'm doing wrong, could do better or need to do are more than welcome.
Thanks for reading this far and I await any replies :)
I have a list of about 200 crops on a column, and for each crop I have 6 information (income, amount of land, season, etc.) in the following 6 columns. I have this information for about 100 households in 6 villages.
I am now starting to put these info in the computer, and it is an enourmous task. I thought that one way to do it is design a form in Access, and have one file per village. I then want to analyse the data at the household level for each village, and also analyse the data at the village level (after calculating village averages).
I want to recreate the form I used to interview farmers in Access, but I can't figure out how to make Access automatelly have 7 columns in form view (the first with the name of the crop, the next 6 with the information: income, etc.). The idea is to reproduce as closely as possible the form I used to interview the farmers, so as to facilitate the data-entry.
Does anybody know how to let Access automatically sort all the fields into 7 columns? Of course I can design the form manually (putting each field individually in its right place), but then I have 7 x200 fields to move, and it would take a huge amount of time. I can't believe that Access can't do this automatically, but I can't figure out how.
I then plan to transfer the info for analysis to SPSS. Does anybody foresee a problem?
Do I make sense? If anybody can help, I would be very grateful. This is actually very urgent, because I am going to pay somebody to do it, but I have to tell her how to do it over the week-end. Thank you very much!!
is there an easy way to copy the current record on a form when clicking a command button such that a snapshot of that record is copied to a table for archiving purposes?
the table has about 120 columns so it is cumbersome to write an Insert Into sql statement within VBA code.
what i am attempting should be quite straightforward...i just want to take the current record in its entirety that is from a single table and append it to another table of the same structure.
I have an old form (see oldform pics) and a new form (see newform pics). The old form has controls on it which work just dandy (well, at least they display and store information). The new, tabbed, form however does not. What's up with that? I simply created a form, created a tab control, went to my old form in design view, selected some objects, right-clicked-copy, went back to the new tabbed form, right-clicked-paste somewhere in the middle on the tab control, and... Presto! Nothing.... Just #Name?
Strange thing is, when I create the control, for example InitialCall, myself or using the wizard, the #Name? disappears, so then it works like it should.
What's going on? I need to do this for a bunch of controls.... and I would hate to have to do them all 140+ all over again by hand.... copy/paste would be so nice..... :)
I have a main form with a field "Calibration Date" which shows the latest calibration date of a specific item. I have a subform that has a field "Cal Date" that is the latest calibration of this specific Item. In the Subform there may be multipul "Cal Date" enteries for that specific item but in the main form I want the "Calibration Date" to update to the newests Cal Date enetered into the subform.
I have about 25 text boxes that get populated based on a financial transaction; quite often about half of them are empty. i wanted to gray them out if they are emtpy (.enabled = false). I could put a series of IF statements in the vba for each one, but its bulky and time-consuming. I've done for each record in tables and recordsets. Is there a way to do a for each textbox on a form?