Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 15th, 2004, 01:41 PM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Prefix zero conditionally: A newbie question

Hi,
I'm relatively new to VBA/Access. I have a field (text format) which contains items (of about 5000) of length 12 or 13 in an Access table. I want to prefix a "0" before all items having a length of 12 to make it 13. How can I do that? Where should i do that?? I tried putting an IF statement in VBA editor, but returned with syntax error. Please help
Thanks
Soorya
Reply With Quote
  #2 (permalink)  
Old October 18th, 2004, 03:13 AM
Authorized User
 
Join Date: Jul 2003
Location: Stockton on Tees, , United Kingdom.
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try:
if len(strText) = 12 then
    strText = "0" & strText
end if

Cheers Ray
Reply With Quote
  #3 (permalink)  
Old October 18th, 2004, 12:17 PM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Ray. I was trying to implement similar logic in Access, but had a hard time getting reference to field in Access table and update it with this logic.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie question peterh Classic ASP Databases 3 January 17th, 2008 11:25 AM
Newbie Question - Sorry! KP Crystal Reports 1 June 13th, 2006 02:45 AM
C# Newbie Question jazzcatone ASP.NET 2.0 Basics 1 May 25th, 2006 10:18 PM
newbie question Warbird XML 0 May 11th, 2005 08:41 AM
Newbie question Beginner VB.NET 2002/2003 Basics 2 November 9th, 2003 06:58 AM



All times are GMT -4. The time now is 02:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.