Re: Easier / different way to do this



It is bad practice to rely on the recordcount property. You are better off
using a SQL statement like

SELECT Count(*)
FROM YourTable
WHERE SomeCriteria

and check the value of field 0 in the recordset returned.

--
Terry Kreft



"TD" <dlee@xxxxxxxxxxx> wrote in message
news:1131559617.534299.95290@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I now use a DAO connection SQL statement, and recordcount to check to
> see if a number the user has input into a textbox is already in the
> database. If the number dose exist I use the MsgBox() to inform the
> user as such. A new record cannot be created until the user enters a
> number that is unique.
>
> I know I can set the field in the table to force a unique number but
> was wondering if there was a way to do everything I'm now doing without
> using VBA to do it? Sometimes I feel I like I don't use all of the
> built in features of Access when I revert to using VBA. Don't get me
> wrong as I like using code to do things but want to learn all I can
> about Access.
>
> Thanks,
> TD
>


.



Relevant Pages

  • Re: Recordcount / Variable
    ... the SQL statement is not that complex, as already supplied, it is a simple ... A variable I am using to ReDim an Array is not getting the number I ... rememeber that the recordcount property will show ... If you're using ADO, then my view is that the ADO recordcount is not ...
    (microsoft.public.access.formscoding)
  • Re: recordcount per date ? could you do that?
    ... recordcount per date ... And how does this IN ANY WAY look like the SQL statement you were given? ... RoomCount. ... else you'll just get the first room count in the list. ...
    (microsoft.public.vb.general.discussion)
  • Re: recordcount per date ? could you do that?
    ... so where is on the sql statement to tell the informations of the ... recordcount per date ... Set rsRoom = New Recordset ... Flip the GROUP BY and FROM clauses.... ...
    (microsoft.public.vb.general.discussion)
  • Easier / different way to do this
    ... I now use a DAO connection SQL statement, and recordcount to check to ... see if a number the user has input into a textbox is already in the ... built in features of Access when I revert to using VBA. ...
    (comp.databases.ms-access)
  • RE: Run-time Error 3704 in VB6
    ... I found when using vba, that if you call the recordcount, you must first ... movelast. ... dim rc as integer ...
    (microsoft.public.data.ado)

Loading