how do I detect if a field is an autonumber field?

L

l prince

Is there an easy way to determine if a field in a
recordset is an autonumber field? I would like to do
something like:

if rst.fields(index).???? = dbautoincrField then
do something
else
do something else
end if

I can't seem to figure out how to use the attributes
property since it seems to be a sum of all the
possibilities.

thanks!
 
F

Francesc Hervada-Sala

Hello,

I can't seem to figure out how to use the attributes
property since it seems to be a sum of all the
possibilities.

If the variable "propvalue" contains the attributes and you want to
check for the atribute "atr" you can use an And:

If (propvalue AND atr) = atr Then
... has atr
Else
... it has not atr
End If

Example:

2 = 0010
4 = 0100
8 = 1000
--------
6 = 0110

6 And 2 = 0110 And 0010 = 0010 = 2
6 And 8 = 0110 And 1000 = 0000

HTH
 
L

l prince

Yes, that helps! I had to walk through it in the debug
window, before I could understand it, but I've got it
now. I've never seen "AND" used quite this way before.

Thanks!
 

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

Top