General information
Category:
Coding, syntax & commands
>>>>>>Hello,
>>>>>>
>>>>>>I have a UDF called ConvToView that takes a value and converts it to a normal looking time. For Example, I store 5:00p in a table as 1700.
>>>>>>
>>>>>>My problem is I want a grid that has a column bound to this particular field but I need to run this UDF on it first. In other words I want 5:00p to show in the text box rather than 1700.
>>>>>>
>>>>>>I have tried to put in the ControlSource of the column ConvToView(ava_bgntime) but this doesn't work. I also tried to put the function call in the InterActiveChangeEvent of the text box in the column but this didn't work either. Any Ideas?
>>>>>>
>>>>>>Paul
>>>>>
>>>>>If you will set ColumnX.ControlSource to Thisform.ConvToView(table.time) in Form Designer, then it should work Ok, assuming that ConvToView is form method.
>>>>
>>>>ConvToView is a function in a separate prg file. The main reason for this is that I use this function in many forms.
>>>
>>>I think that it will work too, assuming that you Set Procedure to the prg file.
>>
>>I have set procedure to the prg file. Whats odd is that if I just leave the control source to the table fields the grid shows the records(except that the time field is just a number) but as soon as I put ConvToView(ava_bgntime) in the controls source of the second column then no records appear in the grid plus I do not get an error message.
>>
>>Weird, huh?
>
>Yes, it's weird. Is ava_bgntime field name? Did you try to add alias? Is it possible that you switched aliases in prg. I guess you should:
>1. Test it with Form' method.
>2. Test it adding new column on right.
>I believe you will get right behaviour moving this way. The ultimate way to avoid controlsource problems is to set them for each column programmatically.
I tried making ConvToView a method for the form and then I set the control source of column2 programatically and now I get an error that says "the data source for this object must be a variable reference" I clicked on help and it sounds like I am not allowed to use an expression for a control source. Does this make sense?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only