DMax Acting Up

D

DS

This Works.....
Me!SalesID = SType & CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2)) + 1

This Doesn't.....
Me!SalesID = TTypes & CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2)) + 1

SType is an Unbound TextBox
TTypes is a bound Textbox


I keep getting Type Mismatch

Any Help...always appreciated
Thanks
DS
 
D

DS

Connie said:
Is your TTypes field a number field?

This Works.....
Me!SalesID = SType & CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2)) +
1

This Doesn't.....
Me!SalesID = TTypes & CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2)) +
1

SType is an Unbound TextBox
TTypes is a bound Textbox


I keep getting Type Mismatch

Any Help...always appreciated
Thanks
DS
TTypes contains a letter E, Q, T, P, D etc...
SalesID is a Text field
Thanks
DS
 
K

Ken Snell [MVP]

Try this:

Me!SalesID = TTypes & (CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2)) +
1)

I think that ACCESS is becoming confused by the presensce of both the & and
+ operators when your values are a combination of text and number.

--

Ken Snell
<MS ACCESS MVP>



DS said:
Connie said:
Is your TTypes field a number field?

This Works.....
Me!SalesID = SType & CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2)) +
1

This Doesn't.....
Me!SalesID = TTypes & CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2))
+
1

SType is an Unbound TextBox
TTypes is a bound Textbox


I keep getting Type Mismatch

Any Help...always appreciated
Thanks
DS
TTypes contains a letter E, Q, T, P, D etc...
SalesID is a Text field
Thanks
DS
 
C

Connie

I've tested your exact syntax & it's working for me. Can you explain a
little more on where & how you're using this line of code. Do users enter
the TType & then click a button to get the next SalesID? Also you state the
TTypes is a bound textbox .. I take it the field it's bound to is a text
field?

DS said:
Connie said:
Is your TTypes field a number field?

This Works.....
Me!SalesID = SType & CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2))
+

1
This Doesn't.....
Me!SalesID = TTypes & CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2))
+

1
SType is an Unbound TextBox
TTypes is a bound Textbox


I keep getting Type Mismatch

Any Help...always appreciated
Thanks
DS
TTypes contains a letter E, Q, T, P, D etc...
SalesID is a Text field
Thanks
DS
 
D

DS

Ken said:
Try this:

Me!SalesID = TTypes & (CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2)) +
1)

I think that ACCESS is becoming confused by the presensce of both the & and
+ operators when your values are a combination of text and number.
Thank you but at this point I changed my design on the advice of another
poster so I no longer have to combine these values. Once agai Thank you.
DS
 
D

DS

Connie said:
I've tested your exact syntax & it's working for me. Can you explain a
little more on where & how you're using this line of code. Do users enter
the TType & then click a button to get the next SalesID? Also you state the
TTypes is a bound textbox .. I take it the field it's bound to is a text
field?

Connie said:
Is your TTypes field a number field?



This Works.....
Me!SalesID = SType & CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2))
+
1


This Doesn't.....
Me!SalesID = TTypes & CLng(Mid(Nz(DMax("[SalesID]", "Sales"), "A0"), 2))
+
1


SType is an Unbound TextBox
TTypes is a bound Textbox


I keep getting Type Mismatch

Any Help...always appreciated
Thanks
DS
TTypes contains a letter E, Q, T, P, D etc...
SalesID is a Text field
Thanks
DS
Thank you....At this point I changed my design based on the advice of
another poster.....I still can't understand why it didn't work though.
All I can think of is that its a bound field, like I said Thank You.
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DMax Problem (Type Mismatch) 11
Custom Counter Code 9
Alpha Incrementing 7
SQL Syntax Problem 2
Auto increment Not Functioning Correctly 2
SQL Returns No Value 2
Loop Returning One Value 6
Custom Autonumber Help 10

Top