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

Need VB function to convert Date to text for Access97

Status
Not open for further replies.

Dylan

MIS
Aug 27, 1998
109
US
I have a linked (Excel) tbl in an access db with date fields. I need to convert these with VB code in a procedure to text flds. <br>
Any help would be appreciated.<br>
<br>
Thanks
 
Not sure exactly what you are trying to do, but in general, the linking of excel in Access (using the '97 Suite) was implemented by microsoft abysmally. I do not have the ms tech tip right now, but it says you have convert the excel 97 sheet to excel 4 in order for data updates to the linked excel sheet to actually stick in the excel sheet.<br>
<br>
I suggest that you add the text fields, and move the data into them, if this is a possible solution. You can programatically make new fields in an Access table, and you could programatically add a column to your excel spreadsheet from Access.
 
You can use the Format function to change the date to a string.

You use the format function like this:

Dim MyDate As Date
Dim MyStr as String
MyDate = #1/1/02#


MyStr = Format(MyDate, &quot;m/d/yyyy&quot;); Returns &quot;1/1/2002&quot;

MyStr = Format(MyDate, &quot;mmmm d, yyyy&quot;); Returns &quot;January 1, 2002&quot;

MyStr = Format(MyDate, &quot;mmmm yyyy&quot;); Returns &quot;January 2002&quot;


;-)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top