| 
	
		| Subject | Re: COMBOBOX |  
		| From | Mervyn Bick <invalid@invalid.invalid> |  
		| Date | Sun, 22 Mar 2020 14:46:50 +0200 |  
		| Newsgroups | dbase.getting-started |  | On 21/03/2020 23:49, Al W wrote:
 > Hi
 > I have created a form PROJECT.wfm that has a field ENTRYFIELDWF_OPT11
 > I have also added to that form a Combobox named Trade1 from the Component Pallete
 >
 > I have a Form OPTIONS – WORKFORCE.wfm with ENTRYFIELDWORKFORCE_OPTION1 and a table OPTIONS – WORKFORCE.dbf that also has a field ENTRYFIELDWORKFORCE_OPTION1
 >
 > I would like enter or link data to ENTRYFIELDWF_OPT11 from a list in the combo box that can be expanded to pick a ENTRYFIELDWORKFORCE_OPTION1 from either the OPTIONS – WORKFORCE Form or Table.
 > I have not been able to figure it out. How do I do it?
 >
 
 
 Firstly, do yourself a favour and avoid spaces in field, form (and that
 includes reports, programs and so on) and table names.  Also avoid using
 reserved words. (There is a list in the help file.)  dBASE accepts them
 but they can require special handling in code.  Rather use an underscore
 _ in place of a space.
 
 The form designer uses uppercase for the names of components which are
 dragged from the Component Palette to a form.  If you stick with the
 default names you may as well leave the upper case.  If, on the other
 hand, you are going to change the names to be more meaningful then you
 can make your code more readable at the same time by using, say,
 something like EF_wf_opt11 instead of ENTRYFIELDWF_OPT11 and
 EF_workforce_option1 instead of ENTRYFIELDWORKFORCE_OPTION1.
 
 Do you really need to populate ENTRYFIELDWF_OPT11 on PROJECT.WFM from
 two places?  It can be done but it seems to be unnecessary work.  If you
 create a query for the table on PROJECT.WFM and set the combobox's
 dataSource (NOT the dataLink) property to the field in your table it
 will give you exactly the same options as you will have on the separate
 form.
 
 Use the combobx's onChange event handler to transfer the selected value
 from the combobox to the entryfield.
 
 function Trade1_onChange()
 form.ENTRYFIELDWF_OPT11.value = this.value
 return
 
 The next question is do you really need the entryfield?  In your code
 your user can just as easily see the the selected trade in the combobox
 as in the entryfield.
 
 I can't do it right now but if you really need to be able to make the
 selection from two places I'll try and make time in the next day or so
 to create an example for you.
 
 Mervyn.
 
 
 |  |