473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Need help on updating text box!

I have the following query and I am figuring a number to fill a text
box in a form. The code works but I cant get the text box to update
unless I change record stes and then come back.
I have the line Call GetCampDays is in 3 places.
1. The After Update event of the Start Date Control
2. The After Update event of the End Date Control
3. The Current event of the form
Anyone have any other thoughts? Thanks for help!!
Dim intTotalDays As Integer ' Counter for number of days
Dim dtmToday As Date ' To increment the date to compare
dtmEnd = DateAdd("d", -1, dtmEnd) 'don't count last day
therefore don't even look at it
intTotalDays = 0 'Startwith 0 days ' We have 0 days to
start
dtmToday = dtmStart
'InitiateCompare Date
Do Until dtmToday > dtmEnd
intTotalDays = intTotalDays + 1 ' Assum we will count

then take our weekend and Holiday
If Weekday(dtmToday, vbMonday) > 4 Then 'It is
Saturdayor Sunday
intTotalDays = intTotalDays - 1 'Take one
dayaway for weekend
ElseIf Not IsNull(DLookup("[Holidate]", "Holidays", _
"[Holidate] = #" & dtmToday & "#")) Then 'It is
aHoliday
intTotalDays = intTotalDays - 1 'Take one
dayaway for the Holiday
End If
dtmToday = DateAdd("d", 1, dtmToday) 'Add a day
forNext Compare
Loop
'Until dtmToday > dtmEnd
'All days havebeen compared
CalcWorkDays = intTotalDays 'Return the
Value

Dec 20 '05 #1
11 1244
I don't fully understand your problem but you could try using
Me.Refresh or Me.Requery in your form. Me.Requery won't do any good
unless you have bound controls.

Dec 20 '05 #2
I have tried everything I can think of to get it to update. It will
only update when I go to another record set and then back. Thats the
problem.

Dec 20 '05 #3
I see Me.Requery was suggested, but have you tried ...

Me.txtMyTextBox.Requery
--
Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast
"deercreek" <da*@deercreekcg.com> wrote ...
I have tried everything I can think of to get it to update. It will
only update when I go to another record set and then back. Thats the
problem.

Dec 20 '05 #4
Where are you suggesting I should put this within the text box or form?

Dec 20 '05 #5
The word wrap on your posted code made it difficult for
me to follow, so I can't point you to a specific line, but it
should go in the code, directly following the line of code
that changes the value of the text box.
--
Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast

"deercreek" <da*@deercreekcg.com> wrote ...
Where are you suggesting I should put this within the text box or form?

Dec 20 '05 #6
Nope didn't work either.

Dec 20 '05 #7
Well, I know this works in general, because I just posted this recently
for someone else. In trying to reproduce the issue, I can't recreate the
situation you describe. Something funky is going on. Can you post your
code again ... without the comments that wrap poorly, if possible?
--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast
"deercreek" <da*@deercreekcg.com> wrote ...
Nope didn't work either.

Dec 20 '05 #8
Ok I tried looking back at your code and you say that
you have the call GetCampDays in three places, but the
partial function you posted appears to be named
CalcWorkDays. If that is the case, it could cause the
text box not to update. Make sure the text box is
calling the correct function.

--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast
"deercreek" <da*@deercreekcg.com> wrote ...
Nope didn't work either.

Dec 20 '05 #9
THE MODULE NAME IS GETCAMPDAYS

Dec 20 '05 #10
This is pretty complicated. Obviously there is something about your
code that Access is mishandling and I suspect that it's beyond anyone
who posts here. I don't blame you if you are frustrated.
I suggest you call MS Support (1-800-936-3500); I'm sure they'll
understand and have you up and running in a jiffy.
Hope this helps!
Merry Christmas!

Dec 20 '05 #11
Ok. Getting info out of you is like pulling teeth, so let me
put it this way.

You have a module named GetCampDays which contains a function
named CalcWorkDays, which, I hope, has the signature like ...

Public Function CalcWorkDays(ByVal dtmEnd As Date) As Integer
' do stuff here
CalcWorkDays = intTotalDays
End Function

This is declared as Public, so it will be visible and is a Function
because it returns a value, an Integer, the total days.

You wrote ...
I have the line Call GetCampDays is in 3 places.
1. The After Update event of the Start Date Control
2. The After Update event of the End Date Control
3. The Current event of the form

Are you saying that you put something like this in the Event Property
for each of those events?

=CalcWorkDays(Me.txtDateEnd)

Or are you saying you created event procedures for each of those
events and called the function?

Call CalcWorkDays(Me.txtDateEnd)

Of course, the call isn't assigning a value anywhere, so it would have
to look more like this ...

Me.txtDays = CalcWorkDays(Me.txtDateEnd)
Me.txtDays.Requery

I suggest that you put a break point in the public module to see if the
execution is actually getting there, and if so, when. I remember you
said that moving forward and back reveals the value, but as a matter
of debugging, you should follow the flow to see when and where the
value is being set. Then you can begin to determine where the Refresh
should be.
--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast
"deercreek" <da*@deercreekcg.com> wrote ... THE MODULE NAME IS GETCAMPDAYS

Dec 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
5
by: khan | last post by:
this is my code, it is updating QTY on Hand when you make a new sale or if you got some product returned. Now as it is updating QTY when qty textbox lost focus if some one is going through...
1
by: Barry Gast | last post by:
Hi. I seem to be running into a problem with binding the text property of a text box to a column in a data table. When the user updates the text in the text box through the interface (form), the...
1
by: JNariss | last post by:
Hello, I have created a form called frmS2P with the following: 1 listbox called List11 which holds the contents of a query created off my table called tblRequestActions. The fields which the...
4
by: Bonzol | last post by:
..Net 2003, 1.1, Access database. oledb connection Hey there, I had my program updating to the database with a dataset,,, doing things the easy way, binding the dataset to the text box n such,...
5
by: CCLeasing | last post by:
Hello, I have searched google but can not find a straight forward answer to my problem. Hopefuly someone will be kind enough to offer their expertise. Please forgive if this seems a bit convoluted...
0
by: CCLeasing | last post by:
Hello, I have searched google but can not find a straight forward answer to my problem. Hopefuly someone will be kind enough to offer their expertise. Please forgive if this seems a bit convoluted...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
10
by: chimambo | last post by:
Hi All, I have a little problem. I am retrieving records from a table and I want to update the records using checkboxes. I am able to display the database record quite alright and I have created...
9
by: Marianne160 | last post by:
Hi, I know there are various answers to this problem available on the web but none of them seem to work for me. I am using Access 2003 to make a form to look up data from a table. I have so far...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.