RE: Finding a value and then finding a value from that

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • RE: Finding a value and then finding a value from that
    ... Steve Sanford wrote: ... intHighestNumber = intHighestNumber + 1 ... string but each value separated by a /. ... I get a type mis-match run time error when using this. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Spaces in folder name and file name
    ... Const cstrDatabaseWB As String = "C:\Documents and Settings\5YPJB\My ... There is a space in the folder name "ACS AQ" and multiple spaces in the ... I'm getting a Run time Error 1004 Application/Object Defined Error ... I tried using single quotes inside the double quotes around the file name ...
    (microsoft.public.excel.programming)
  • Re: VBA Error "Type Mismatch"
    ... Tom Ogilvy wrote: ... variety of sources - most of which are string based but some times the ... string is converted from another source hence the data type variant. ... not generate the run time error. ...
    (microsoft.public.excel.programming)
  • RE: value with check box
    ... I am getting Run time error 438 ... Can I do instead of this string the default value for checkbox to no ... > Dim strDefaultValueAs String ...
    (microsoft.public.access.forms)