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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

leading zeroes gone in text field

Status
Not open for further replies.

Hildegoat15

Technical User
Aug 3, 2001
38
CA
I've got a problem that's got me stumped. I work for a respiratory services company and I'm creating a Transfer History table that records if clients transfer to another region (RHA). The destination table has the user's client id (text), old RHA (integer), new RHA (integer) and Transfer Date (date). The insert into statement works 95% well, but if i add a client with id# 00001, that field in the Transfer History table just shows 1. if the client id is a text field, why would it take off the leading zeroes? my code looks like this:


CurrentDb.Execute "INSERT INTO Transfer(ClientID, OldRHA, NewRHA, TransferDate) VALUES (" & Me!txtClientID & ", " & Me!txtOldRHA & ", " & Me!txtNewRHA & ", #" & Me!txtTransferDate & "#);", dbFailOnError


Any suggestions would be greatly appreciated. -Matt
 
I fixed it! i just needed to put single quotes around the ClientIDpart... it now looks like this:

CurrentDb.Execute "INSERT INTO Transfer(ClientID, OldRHA, NewRHA, TransferDate) VALUES ('" & Me!txtClientID & "', " & Me!txtOldRHA & ", " & Me!txtNewRHA & ", #" & Me!txtTransferDate & "#);", dbFailOnError -Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top