setting default values problem

C

chonny

I have form with three fileds with single data type and button that make
value of current record default value of fileds.
code:
Dim rs As Recordset
Set rs = Me.Recordset
me.fA.DefaultValue = rs.Fileds("fA")
me.fB.DefaultValue = rs.Fileds("fB")
me.fB.DefaultValue = rs.Fileds("fB")

Problem:
when the value is integer in rs no problem , this method work , but when
values are doubles in default value appear #Name?

Please help
 
D

Douglas J Steele

Regardless of the field's data type, the DefaultValue property is a string.
Try:

me.fA.DefaultValue = Chr$(34) & rs.Fileds("fA") & Chr$(34)
me.fB.DefaultValue = Chr$(34) & rs.Fileds("fB") & Chr$(34)
me.fB.DefaultValue = Chr$(34) & rs.Fileds("fB") & Chr$(34)
 
C

chonny

Thank you very match,Douglas

Douglas J Steele said:
Regardless of the field's data type, the DefaultValue property is a string.
Try:

me.fA.DefaultValue = Chr$(34) & rs.Fileds("fA") & Chr$(34)
me.fB.DefaultValue = Chr$(34) & rs.Fileds("fB") & Chr$(34)
me.fB.DefaultValue = Chr$(34) & rs.Fileds("fB") & Chr$(34)
 
Top