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
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 May 27th, 2006, 01:36 PM
Authorized User
 
Join Date: May 2006
Location: Elk Grove, CA, USA.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Posting the value of an unbound form field into a

Posting the value of an unbound form field into a table field in access.
I have created a table with 3 fields. StartNum, EndNum, TotalCount.
When I create a form based on this table I have placed the fields in the form. For the Total count field I edited the control source to show =[EndNum]-[StartNum]+1 and it displays the correct value however the value does not enter into the original table only the value typed into the startnum and EndNum reflect. What am I missing?

EB
__________________
EB
Reply With Quote
  #2 (permalink)  
Old May 27th, 2006, 01:44 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You have a couple of options...

An unbound field isn't tied to any part of the table, hence it cannot update the value.

If you were to follow traditional RDMS design methodology, you would not store the value, but just calculate it whenever you display the data.

The other option, is to bind the textbox to the correct control. To calculate it, you would then put an event on the other two boxes, so that when you leave either of those fields, it updates the value in the calculated field.

My personal opinion is that the first option would be the best, but yell if you need a hand with either of them..

Mike

Mike
EchoVue.com
Reply With Quote
  #3 (permalink)  
Old May 27th, 2006, 02:37 PM
Authorized User
 
Join Date: May 2006
Location: Elk Grove, CA, USA.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your response, however, I am required to store all inputs and values.
Here is what I am trying to do. I am creating this database to capture tickets in a range of numbers ex, 1000 to 2000 that is a total of 1001 tickets total so I am having the field capture that value when inputed so that I can capture a running total as more tickets are inputed ex 2001 to 3000 that is another 1000 tickets.
I am not able to capture the running totals because the totalcount field in the table does not capture the value from the form's control field. Is there a way to modify my table and form to post this data?

EB
Reply With Quote
  #4 (permalink)  
Old May 27th, 2006, 02:43 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Are you familiar with VBA at all?

Mike
EchoVue.com
Reply With Quote
  #5 (permalink)  
Old May 27th, 2006, 02:44 PM
Authorized User
 
Join Date: May 2006
Location: Elk Grove, CA, USA.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Not really. Would it be hard to code?

EB
Reply With Quote
  #6 (permalink)  
Old May 27th, 2006, 02:57 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Not really...

I am assuming you'll enter the EndNum last, so go to that text box, look at the properties, and choose the On_LostFocus event. Next click the little button next to it and choose the Code option.

In the sub procedure which is built enter something like

TotalCount = EndNum - StartNum + 1

Some variations that you may need would include...

Me.TotalCount = Val(Me.EndNum) - Val(StartNum) +1

Then just set the recordsource of the TotalCount text box to the field in the table, instead of the formula. It should auto populate when you tab or click out of EndNum.

Hope that helps,

Mike

Mike
EchoVue.com
Reply With Quote
  #7 (permalink)  
Old May 27th, 2006, 03:01 PM
Authorized User
 
Join Date: May 2006
Location: Elk Grove, CA, USA.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Mike, I will try that and let you know what I come up with.

Thank you

eric

EB
Reply With Quote
  #8 (permalink)  
Old May 27th, 2006, 04:35 PM
Authorized User
 
Join Date: May 2006
Location: Elk Grove, CA, USA.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mike

Thank you very much. That worked. =)

EB
Reply With Quote
  #9 (permalink)  
Old May 27th, 2006, 04:38 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Good to hear, thanks!

And welcome to the Forum - I am sure you'll find it and excellent resource when trying to figure stuff out. More heads are always better than one!

Have a good one :)

Mike

Mike
EchoVue.com
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
unbound field in subform chacquard Access VBA 4 February 7th, 2007 10:01 AM
unbound field in a form zanza67 BOOK: Access 2003 VBA Programmer's Reference 0 September 3rd, 2005 01:46 PM
Unbound field lee27 VB Databases Basics 1 January 5th, 2005 07:53 AM
How to bind unbound field ? cjordan BOOK: Professional Crystal Reports for VS.NET 1 January 23rd, 2004 01:34 PM
Retreiving data from unbound field? lanctotd Access VBA 7 July 28th, 2003 07:12 AM



All times are GMT -4. The time now is 01:51 PM.


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