DCount text and autonumber

  • Thread starter Thread starter DevourU
  • Start date Start date
D

DevourU

DCount("field1","QueryName","field1 <='" & [field1] & "'") works fine with a
text field. What am I missing for an autonumber field? I get data type
mismatch error. TIA

-JS
 
Text and numbers (and Dates) are handled differently in expressions. You
don't need the extra quotes for numbers.
DCount("field1","QueryName","field1 <=" & [field1])
 
Thankx for the help. It works, but listed ascending, it shows as text.
1
10
100
101
102
etc

I am trying to sequentially number records in a query and return record
numbers < [value supplied from form]

-JS

Duane Hookom said:
Text and numbers (and Dates) are handled differently in expressions. You
don't need the extra quotes for numbers.
DCount("field1","QueryName","field1 <=" & [field1])


--
Duane Hookom
MS Access MVP
--

DevourU said:
DCount("field1","QueryName","field1 <='" & [field1] & "'") works fine
with a text field. What am I missing for an autonumber field? I get data
type mismatch error. TIA

-JS
 
Never mind, format did the trick. Thankx

-JS

DevourU said:
Thankx for the help. It works, but listed ascending, it shows as text.
1
10
100
101
102
etc

I am trying to sequentially number records in a query and return record
numbers < [value supplied from form]

-JS

Duane Hookom said:
Text and numbers (and Dates) are handled differently in expressions. You
don't need the extra quotes for numbers.
DCount("field1","QueryName","field1 <=" & [field1])


--
Duane Hookom
MS Access MVP
--

DevourU said:
DCount("field1","QueryName","field1 <='" & [field1] & "'") works fine
with a text field. What am I missing for an autonumber field? I get data
type mismatch error. TIA

-JS
 
Did you consider searching Help for a function that might create a numeric
value from a text/string? Find the function and wrap it around the DCount().

--
Duane Hookom
MS Access MVP
--

DevourU said:
Thankx for the help. It works, but listed ascending, it shows as text.
1
10
100
101
102
etc

I am trying to sequentially number records in a query and return record
numbers < [value supplied from form]

-JS

Duane Hookom said:
Text and numbers (and Dates) are handled differently in expressions. You
don't need the extra quotes for numbers.
DCount("field1","QueryName","field1 <=" & [field1])


--
Duane Hookom
MS Access MVP
--

DevourU said:
DCount("field1","QueryName","field1 <='" & [field1] & "'") works fine
with a text field. What am I missing for an autonumber field? I get data
type mismatch error. TIA

-JS
 
CDbl did the trick. Thankx

-JS

DevourU said:
Never mind, format did the trick. Thankx

-JS

DevourU said:
Thankx for the help. It works, but listed ascending, it shows as text.
1
10
100
101
102
etc

I am trying to sequentially number records in a query and return record
numbers < [value supplied from form]

-JS

Duane Hookom said:
Text and numbers (and Dates) are handled differently in expressions. You
don't need the extra quotes for numbers.
DCount("field1","QueryName","field1 <=" & [field1])


--
Duane Hookom
MS Access MVP
--

DCount("field1","QueryName","field1 <='" & [field1] & "'") works fine
with a text field. What am I missing for an autonumber field? I get
data type mismatch error. TIA

-JS
 
Back
Top