PC Review


Reply
Thread Tools Rate Thread

Code Not working

 
 
LJG
Guest
Posts: n/a
 
      2nd Jan 2006
Hi Guys,

Any idea why this code does not work?

Private Sub Form_BeforeInsert(Cancel As Integer)
Me!txtID = Nz(DMax("[CustNumber]", "[tblContacts]")) + 1
End Sub

Have used it before in another form and works fine, object & table names are
correct

TIA
Les


 
Reply With Quote
 
 
 
 
Rick Brandt
Guest
Posts: n/a
 
      2nd Jan 2006
LJG wrote:
> Hi Guys,
>
> Any idea why this code does not work?
>
> Private Sub Form_BeforeInsert(Cancel As Integer)
> Me!txtID = Nz(DMax("[CustNumber]", "[tblContacts]")) + 1
> End Sub
>
> Have used it before in another form and works fine, object & table
> names are correct


What "doesn't work" about it? Do you get an error?

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


 
Reply With Quote
 
 
 
 
LJG
Guest
Posts: n/a
 
      2nd Jan 2006
No, just does not update the CustNumber, keeps just adding 10000 as the next
number


"Rick Brandt" <(E-Mail Removed)> wrote in message
news:T4buf.43721$(E-Mail Removed)...
> LJG wrote:
>> Hi Guys,
>>
>> Any idea why this code does not work?
>>
>> Private Sub Form_BeforeInsert(Cancel As Integer)
>> Me!txtID = Nz(DMax("[CustNumber]", "[tblContacts]")) + 1
>> End Sub
>>
>> Have used it before in another form and works fine, object & table
>> names are correct

>
> What "doesn't work" about it? Do you get an error?
>
> --
> I don't check the Email account attached
> to this message. Send instead to...
> RBrandt at Hunter dot com
>



 
Reply With Quote
 
Rick Brandt
Guest
Posts: n/a
 
      2nd Jan 2006
LJG wrote:
> No, just does not update the CustNumber, keeps just adding 10000 as
> the next number


If CustNumber is text then that is what will happen when you get 9999 since the
"max" is alphabetical instead of numeric.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


 
Reply With Quote
 
LJG
Guest
Posts: n/a
 
      2nd Jan 2006
Ahhh....cool thanks for that, explains it, the field is text
Thanks
Les


"Rick Brandt" <(E-Mail Removed)> wrote in message
news:GRbuf.43732$(E-Mail Removed)...
> LJG wrote:
>> No, just does not update the CustNumber, keeps just adding 10000 as
>> the next number

>
> If CustNumber is text then that is what will happen when you get 9999
> since the "max" is alphabetical instead of numeric.
>
> --
> I don't check the Email account attached
> to this message. Send instead to...
> RBrandt at Hunter dot com
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is my GetFields(BindingFlags.Instance | BindingFlags.Public) not working? (Sample working code included) sloan Microsoft C# .NET 3 12th Jun 2010 12:43 AM
Code working in 1.1 stops working in 2.0 Piyush Daiya Microsoft Dot NET Framework 1 4th May 2007 06:21 PM
Code to simulate mouse click not working - code sample attached John Michl Microsoft Powerpoint 3 19th Oct 2005 03:00 PM
[New] Zipoid - ZIP Code, City Name and Area Code Lookup - Zip Code to Zip Code Distance Calculation Mel Freeware 0 22nd Jul 2005 04:13 PM
code completion not working in code-behind file jason Microsoft ASP .NET 4 2nd Jun 2005 05:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:24 AM.