setting default values problem

G

Guest

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)
 
G

Guest

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top