Good evening , dear programmers .
I have a small problem (hope solvable
) .
I am designing a Public Function F()
I want this function to populate value from a any field selected from any table to any text box in any form ...... Sounds a bit crazy probably but I will try to explain my idea .
Lets say in a Database named TestDB we have a Table named tblTest , a Form named frmTest and in this form( frmTest ) we have one Bound Combo Box named cmbTest and one unbound TextBox named txtTest
We assume that the table tblTest has three fields : TestID , FName and LName .
We also assume that there are already some records in the Table tblTest .
If the function F() is already programmed it should take as arguments as it follows :
F(FormName as??? ,ControlName as ???, TableName as ???, FieldName as ???, ID_Field_Name_of_the_Table as ???, Combo_box_selected_ID as ???)
In result the function should (probably) DLookup (FieldName , TableName , ID_Field_Name_of_the_Table = Combo_box_selected_ID )
and then store the value in a variable ( probably Variant ???) , lets say called varSetValue
The problem is IF this is the correct way to handle that issue , than what should i do next....
I really don't know how to pass a Control's name to a function from the Event module of the ComboBox -
I mean - how can I obtain the value so it is usable for the function .... What data type should be the function arguments so I can use them to set a value for a control in any form .
In example :
If the Dlookup() is somehow successfull then I want to assign the varSetValue to the txtTest what should I do :
FormName.ControlName.Value = varSetValue >??????
I have read a lot materials but couldn't find a good answer for that , and aswell what data type should be the arguments that the function accepts and how do I obtain Controls and Forms names so I could use them in the function as described above .
Sorry for the long writing but I am really into a blackhole
I have a small problem (hope solvable
I am designing a Public Function F()
I want this function to populate value from a any field selected from any table to any text box in any form ...... Sounds a bit crazy probably but I will try to explain my idea .
Lets say in a Database named TestDB we have a Table named tblTest , a Form named frmTest and in this form( frmTest ) we have one Bound Combo Box named cmbTest and one unbound TextBox named txtTest
We assume that the table tblTest has three fields : TestID , FName and LName .
We also assume that there are already some records in the Table tblTest .
If the function F() is already programmed it should take as arguments as it follows :
F(FormName as??? ,ControlName as ???, TableName as ???, FieldName as ???, ID_Field_Name_of_the_Table as ???, Combo_box_selected_ID as ???)
In result the function should (probably) DLookup (FieldName , TableName , ID_Field_Name_of_the_Table = Combo_box_selected_ID )
and then store the value in a variable ( probably Variant ???) , lets say called varSetValue
The problem is IF this is the correct way to handle that issue , than what should i do next....
I really don't know how to pass a Control's name to a function from the Event module of the ComboBox -
I mean - how can I obtain the value so it is usable for the function .... What data type should be the function arguments so I can use them to set a value for a control in any form .
In example :
If the Dlookup() is somehow successfull then I want to assign the varSetValue to the txtTest what should I do :
FormName.ControlName.Value = varSetValue >??????
I have read a lot materials but couldn't find a good answer for that , and aswell what data type should be the arguments that the function accepts and how do I obtain Controls and Forms names so I could use them in the function as described above .
Sorry for the long writing but I am really into a blackhole