Need help with strings in vba vb access
First off I just wanted to say thanks to all the people that helped so far. I have been developing in vba for the past 3 weeks and have a pretty firm understanding of it. Well anyways heres my problem.
Im saving a date string in this format ("11/14/05") as part of the title of a excel spreadsheet I am generating from access.
The problem:You cant save a filename under this format obviously. So I want to change:
11/14/05 to 11_14_05
So basically I need the char position the concatinate & "_" where the "/" would have been. What is the correct syntax to do this in vba/visual basic access?
Re: Need help with strings in vba vb access
Use the replace function.
Here's an example.
VB Code:
Private Function NewDate(OldDate As String) As String
NewDate = Replace(OldDate, "/", "_")
End Function
Re: Need help with strings in vba vb access
I like it! Thank you. Is there a way to physically change strings for future reference?
_Stephen
Re: Need help with strings in vba vb access
Change them into what? :sick:
Re: Need help with strings in vba vb access
Oh I meant is there a way to pick out the certain characters you want to display.
_Stephen
Re: Need help with strings in vba vb access
BTW I used that replace and it worked wonders. Now I just need to find out how to populate the excel spreadsheet off of a subform.
Re: Need help with strings in vba vb access
To make the string variable retain the change...
VB Code:
MyDate = Replace(MyDate, "/", "_")