UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Refer To A Calling Field From Another Form, Access 2016    
 
   
startingover0001
post Jan 20 2020, 07:46 PM
Post#1



Posts: 255
Joined: 13-November 10
From: 37745


I know there's got to be a way of doing this.

I have 2 forms. When a field on form1 is double-clicked, it opens form2 which has some calculations on it. When opening form2, I send the field name that called it so when I complete the calculation and click the "ok" button, it puts the value in the field on form1 that called it.

I know you can't simply put: (where me.txtcallingfield is the field name that called form2 to begin with)

Forms![form1]!me.txtCallingField = me.calculation

because the "me.txtcallingfield" has to be a [string]. I tried to convert the value of txtcallingfield to a string

SendBack = Me.txtCallingField.Value
Forms![fSetDevPrefs]!sendback= me.calculation

I even tried putting it in quotes. Forms![fSetDevPrefs]![& chr(34) & SendBack.value & chr(34)] = me.calculatioin

It's always going to be the same form name, but not the same field as there are many fields that will call form2 and the results need to be put in the correct field. I supposed I could do copy and paste but that seems too much round robin hoods barn for something that quite clearly should be so simple.

Thanks
Go to the top of the page
 
Doug Steele
post Jan 20 2020, 07:48 PM
Post#2


UtterAccess VIP
Posts: 22,245
Joined: 8-January 07
From: St. Catharines, ON (Canada)


Try:

CODE
  Forms![form1].Controls(me.txtCallingField) = Me.calculation

--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
Personal webpage
Microsoft profile
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 
startingover0001
post Jan 20 2020, 08:09 PM
Post#3



Posts: 255
Joined: 13-November 10
From: 37745


@Doug...that absolutely did it. I knew it had to be something simple. Thank you so much!!!
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    20th February 2020 - 06:34 PM