Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop divsion calculation in default value

Status
Not open for further replies.

handlebarry

Technical User
Dec 21, 2004
118
GB
hi - I'm using the following code to fill a field when creating new records.

Dim db As Database
Dim tdf As TableDef
Set db = CurrentDb
Set tdf = db.TableDefs("tblContractsToProperties")
tdf.Fields("ContractCode").DefaultValue = Forms!frmContractAmend.ContractCode

However a contract code looks like this 03/002. Which is giving me 1.5!! in the record.

The field a text field, tried changing ot to a memo but the same happens, tried fixed as the format but nothing. I can't change the format of the code. Anyone got any ideas?
 
I was unable to get your result of 1.5 -- it produced the correct 03/002. Anyway, change:
tdf.Fields("ContractCode").DefaultValue = Forms!frmContractAmend.ContractCode

To:
tdf.Fields("ContractCode").DefaultValue = chr(34) & Forms!frmContractAmend.ContractCode & Chr(34)

Code: Where the vision is often rudely introduced to reality!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top