RE: Finding a value and then finding a value from that
- From: Steve Sanford <limbim53 at yahoo dot com>
- Date: Fri, 7 Aug 2009 09:22:02 -0700
Glad you got it working. You shouldn't need to use the CInt() function; the
NZ() function takes care of that by converting a null to, in this case, a
zero.
You should add some checks for length. What gets entered if someone enters
"60909" or "06092009"?
About your other question, did you try
ufnString = dateOfContact & "/" & CStr(intHighestNumber)
Of course, "ufnString" needs to be declared a string or, if a field in a
table, then defined as a type Text.
Also, where is this being used? In the sub "Command35_Click()"?
---------
FWIW, you should take the time to rename objects. Access does a poor job....
it is easier to know what a piece of code does if it is named
"cmdOpenFile_Click()" or "btnProcessPayment_Click()" than
"Command35_Click()". Especially in six months when you are modifying the
code....I kept saying "*What* was I thinking???"
Then I started renaming everything. <g>
---------
HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)
"andycambo via AccessMonster.com" wrote:
Steve Sanford wrote:.
If the field "mDateOfContact" in the table "tblMatters" is a text field, then
this should work:
Thanks for your help. I got it working with this code, pretty much what you
had put.
intHighestNumber = CInt(Nz(ELookup("[mUniqueMatter]", _
"tblMatters", _
"[mDateOfContact]= '" & dateOfContact &
"'", "[mUniqueMatter] DESC"), 0))
intHighestNumber = intHighestNumber + 1
Another question though.
I'm trying to put together the dateOfContact and intHighestNumber into a
string but each value separated by a /.
I keep getting run time error when I try my code. I've tried all sorts of
ideas but nothing has worked.
Here's what I am trying to use.
ufnString = dateOfContact & "/" & intHighestNumber
I get a type mis-match run time error when using this. I think it's because
it is trying to divide the two values which can not happen. How can I use
'/' in a string?
Thanks
Andy.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/200908/1
- Follow-Ups:
- RE: Finding a value and then finding a value from that
- From: andycambo via AccessMonster.com
- RE: Finding a value and then finding a value from that
- References:
- Finding a value and then finding a value from that
- From: andycambo via AccessMonster.com
- RE: Finding a value and then finding a value from that
- From: Steve Sanford
- RE: Finding a value and then finding a value from that
- From: andycambo via AccessMonster.com
- Finding a value and then finding a value from that
- Prev by Date: Re: Connecting two back end Databases
- Next by Date: RE: Email
- Previous by thread: RE: Finding a value and then finding a value from that
- Next by thread: RE: Finding a value and then finding a value from that
- Index(es):
Relevant Pages
|