Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying a field in a form to another Form 1

Status
Not open for further replies.

Stangleboy

Programmer
May 6, 2002
76
US
I learned my leasson on being to brief so bear with me. I have 2 tables and each table has a form to enter data. Tables as:
(1)CaseID-Key
BookNum- Used in several tables
Color
Size
Cover

(2)PhNumID-key
BookNum- Again
PhoneNumbers

My database starts with the CaseID form and the user inputs the correct data, including "booknum". I want them to hit the button (that has a macro setup to open the Phone form/new record) and have the "booknum" to transfer information to automaticall populate the correct field. The last time I touched an Access database was was in early 2003. Thank you ahead of time.
 
just reference values from the CaseID form as follows:

me.txtcorrectfield.value= = Forms!CaseID.txtFirstTextbox.value

that will place the value from form "CaseID" and textbox "txtFirstTextbox" into the textbox "txtCorrectField" on the phNumID form. not exactly sure if this is what you wanted, but it might give you an idea of how to go about it. Let me know.
 
Thank you for your post, I only want this to happen on new forms (records) not edits, is there a way to do this?
 
sure, just use the same code, but check the "NewRecord" property of the form....

if me.newrecord then
me.txtcorrectfield.value = Forms!CaseID.txtFirstTextbox.value
end if

that will only run the code if the record being worked on is a new record which is being added.
 
I tried to use the me code but did not get anywhere. I have two forms. One is named all wool that has a field name called Vendor and the other is form is called all wool po that has a field called to: I do have a command button to open the form all wool po that I would like to have the field vendor from the all wool form to have the current record I have under the all wool form. where do I have to put these code I tried on current event, after update, etc... no success. please help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top