Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | 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 Search this Thread Display Modes
  #1 (permalink)  
Old January 23rd, 2004, 12:37 PM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Location: , , .
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default Data Types

Frist hello and thanks to all the people who look at these questions and give help. I enjoy this site, being new to access/vb coding. I hope someday to give back help to others once I become good at this.

Question: I have a column in a table which is a currency datatype. When the user is entering data via the form, and they get to this field, and they don't have an amount to enter or an amount doesn't pertain to this particluar record, I would like the field to default to "NA", which is text.

I don't think that is possible, but perhaps someone know's a way around that.
Thanks, BPH

Reply With Quote
  #2 (permalink)  
Old January 23rd, 2004, 12:47 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: Houston, Texas, USA.
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Put an invisible label over your field with a caption of NA and when the currency field is null or meets your other conditions, make the label visible and the text box invisible. This will work for your form, but not in the table at which time you will probably need another field, possibly Yes/No field to denote whether it is applicable or not.

Regards,

Beth M
Reply With Quote
  #3 (permalink)  
Old January 23rd, 2004, 01:23 PM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

What you do is not touch the table at all. If the value is null, so be it.

On the form, however, if the form is UNbound, then it's easy because you can populate the textbox with the actual amount (if not null) or you can populate the textbox with the string "N/A" if the actual amount is null. The datatype won't matter because the unbound textbox is not subject to a datatype. When it comes time to save the data back to the table, ignore the "N/A" and just let that value be null in the table.

If your form IS bound, then create an UNbound textbox and label it the same as the bound textbox with the currency amount. Make the bound textbox INvisible. Make the UNbound textbox visible. Then on the form's ON OPEN event you can put something like this, assuming that Me.txtMyAmount is the UNbound, visible textbox and Me.txtMyRealAmount is the bound, INvisible textbox, then

Me.txtMyAmount = Nz(Me.txtMyRealAmount,"N/A")

If you have currency, the visible textbox just shows it. If you don't have currency (the table value is null), the visible textbox will just show "N/A".


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #4 (permalink)  
Old January 25th, 2004, 05:50 PM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Location: , , .
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Got it.
Used the bound and unbound method, only I put it in the 'On Current' Event. That allowed moving from record to record. Thanks.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
System Data Types liamfitz Beginning VB 6 0 October 17th, 2006 05:31 PM
Data Types Clive Astley Access 1 January 17th, 2006 04:13 PM
Data Types edward2006 Infopath 0 November 7th, 2005 06:06 PM
Data types in SQL SQ SQL Language 4 October 3rd, 2004 02:07 AM



All times are GMT -4. The time now is 12:25 AM.


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