Not sure but..The control name should be between double quotes....Controls("txtPole_In_CATV_1").ValueMaybe this will help?
Hi James,I am going to make the assumption that all of these fields are on the same page within the form. If not please let me know.there are two things we need to do:1. write the calculation so that it reads the correct fields and2. use a button or have something execute the calculation.Firstly, if all of the inputs are on one page then that makes things a little easier. If you add a button to the same page and call it btnCalculate, go to the events of the button and where it says OnClick - write: Call myCalculation(). So when you click the button it will look for the routine we are about to write. Press Ok to everything so you are interacting with the Layer Definition of the feature. Click on the scripting button to load a new script window.Now If you have vbScript as your default language the window should have Option Explicit written at Line 1.Under that write: sub myCalculation()So taking your formula: (Pole_Ft_Power_1 + Pole_In_Power_1) - sum of ( Pole_Ft_CATV_1 + Pole_In_CATV_1) = Pole_Separation_1 the script could look something like this:I hope this helps.
sub myCalculation() 'Initiate some objects to store the measurements in dim Pole_Ft_Power_1, Pole_In_Power_1, Pole_Ft_CATV_1, Pole_In_CATV_1, Pole_Separation_1 'This long path is how you read values from a form. There are shorter methods you can write but this hopefully explains itself. Pole_Ft_Power_1 = Application.Map.Layers("yourPoleLayer").Forms("EDITFORM").Pages("PAGE1").Controls(txtPole_Ft_Power_1).Value Pole_In_Power_1 = Application.Map.Layers("yourPoleLayer").Forms("EDITFORM").Pages("PAGE1").Controls(txtPole_In_Power_1).Value Pole_Ft_CATV_1 = Application.Map.Layers("yourPoleLayer").Forms("EDITFORM").Pages("PAGE1").Controls(txtPole_Ft_CATV_1).Value Pole_In_CATV_1 = Application.Map.Layers("yourPoleLayer").Forms("EDITFORM").Pages("PAGE1").Controls(txtPole_In_CATV_1).Value 'This line now sets the calculation to another text box that is on your form. Application.Map.Layers(yourPoleLayer).Forms("EDITFORM").Pages("PAGE1").Controls(txtPole_Separation_1).Value = (Pole_Ft_Power_1 + Pole_In_Power_1) - ( Pole_Ft_CATV_1 + Pole_In_CATV_1)end sub
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.