DMax Acting Up

  • Thread starter Thread starter DS
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
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
 
Back
Top