It works thank you very muchPlease review the updated file. Note that I copied the code into the form module so you could refere to the textbox using the Me.txtbox. I also modified the public function you have in the standard module. You can switch between them in the Open event of the form (removed the macro and used VBA code instead) by commenting one out, you'll see they work the same.
Cheers,