|
-
Nov 14th, 2005, 04:52 PM
#1
Thread Starter
Junior Member
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?
-
Nov 14th, 2005, 05:31 PM
#2
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
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Nov 14th, 2005, 05:55 PM
#3
Thread Starter
Junior Member
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
-
Nov 14th, 2005, 05:57 PM
#4
Re: Need help with strings in vba vb access
Change them into what?
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Nov 14th, 2005, 08:26 PM
#5
Thread Starter
Junior Member
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
-
Nov 14th, 2005, 08:40 PM
#6
Thread Starter
Junior Member
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.
-
Nov 14th, 2005, 08:43 PM
#7
Re: Need help with strings in vba vb access
To make the string variable retain the change...
VB Code:
MyDate = Replace(MyDate, "/", "_")
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|