Can't assign a value to object

A

awm

I have a table where I would like not to use an AutoNumber since I am
importing a file with approx. 1000 sequential numbers. When a new record is
added, I would like to use a DMax formula to create the next sequential
number.

I have tried to develop a form using all the entities of the table however I
cannot "assign a value to the object" when I have tried to create a DMax
formula to use the highest number in the table +1.

Am I approaching this the wrong way? Should I be using macros and queries
to create a new sequential number and append the table with the new record,
or is there a better way to do this?

Thanks.
 
N

Nikos Yannacopoulos

I'm afraid you are not clear enough. What are you trying to achieve?

Do you want to store in your table the sequential numbers in the imported
file, but also be able to add a record manually through a form, and give it
a new sequential number automatically through the form? If that's the case,
then yes, the DMax is the way; put your DMax expression in the default value
property of the control in the form which is bound to the pertinent table
field.

If you are trying to do something else, please explain.

HTH,
Nikos
 
A

awm

Thanks Nikos. Yes I want to develop a form that would provide a new
sequential number as you assumed. On the form, I have a control [RefNo]
that is bound to the underlying table tbl_Quote.RefNo. I have also added
the following formula in the default of the [RefNo] control on the form:
DMax([RefNo], "tbl_Quote")+1. The problem is that when the form is opened
to add a new record, a #Error message appears on the control. I will not
assign a value to the form using the formula or to the underlying table.

Any ideas how to correct?

Thanks.
 
N

Nikos Yannacopoulos

OK, you're close. The default value property is the correct place to do it,
and the DMax function approach is correct, just a minor sybtax flaw! Try:

DMax("[RefNo]", "tbl_Quote")+1

and it will do the job.

HTH,
Nikos

awm said:
Thanks Nikos. Yes I want to develop a form that would provide a new
sequential number as you assumed. On the form, I have a control [RefNo]
that is bound to the underlying table tbl_Quote.RefNo. I have also added
the following formula in the default of the [RefNo] control on the form:
DMax([RefNo], "tbl_Quote")+1. The problem is that when the form is opened
to add a new record, a #Error message appears on the control. I will not
assign a value to the form using the formula or to the underlying table.

Any ideas how to correct?

Thanks.



Nikos Yannacopoulos said:
I'm afraid you are not clear enough. What are you trying to achieve?

Do you want to store in your table the sequential numbers in the imported
file, but also be able to add a record manually through a form, and give it
a new sequential number automatically through the form? If that's the case,
then yes, the DMax is the way; put your DMax expression in the default value
property of the control in the form which is bound to the pertinent table
field.

If you are trying to do something else, please explain.

HTH,
Nikos

record however
 
A

awm

Nikos, this was great. It worked!!!

Could you explain what the difference is between the brackets [] and
quotation marks "" ? When should I use one or another...

Thanks,

Art

----------------------------
Nikos Yannacopoulos said:
OK, you're close. The default value property is the correct place to do it,
and the DMax function approach is correct, just a minor sybtax flaw! Try:

DMax("[RefNo]", "tbl_Quote")+1

and it will do the job.

HTH,
Nikos

awm said:
Thanks Nikos. Yes I want to develop a form that would provide a new
sequential number as you assumed. On the form, I have a control [RefNo]
that is bound to the underlying table tbl_Quote.RefNo. I have also added
the following formula in the default of the [RefNo] control on the form:
DMax([RefNo], "tbl_Quote")+1. The problem is that when the form is opened
to add a new record, a #Error message appears on the control. I will not
assign a value to the form using the formula or to the underlying table.

Any ideas how to correct?

Thanks.



Nikos Yannacopoulos said:
I'm afraid you are not clear enough. What are you trying to achieve?

Do you want to store in your table the sequential numbers in the imported
file, but also be able to add a record manually through a form, and
give
it
a new sequential number automatically through the form? If that's the case,
then yes, the DMax is the way; put your DMax expression in the default value
property of the control in the form which is bound to the pertinent table
field.

If you are trying to do something else, please explain.

HTH,
Nikos

I have a table where I would like not to use an AutoNumber since I am
importing a file with approx. 1000 sequential numbers. When a new record
is
added, I would like to use a DMax formula to create the next sequential
number.

I have tried to develop a form using all the entities of the table however
I
cannot "assign a value to the object" when I have tried to create a DMax
formula to use the highest number in the table +1.

Am I approaching this the wrong way? Should I be using macros and queries
to create a new sequential number and append the table with the new
record,
or is there a better way to do this?

Thanks.
 
N

Nikos Yannacopoulos

Art,

The square brackets tell Access what's in them is an Access object (table,
query, form, report or field / control in one of the former etc.).
The double quotation marks denote a text string.
There is no single rule as to what you use where, it's a question of syntax
for every particular case. Domain aggreagte functions require that all three
arguments (third one - condition - is optional, absent in your case) are
text strings, therefore enclosed in double quotes. Whenever in doubt check
out Help, especially an example on the syntax if one is available.

HTH,
Nikos

awm said:
Nikos, this was great. It worked!!!

Could you explain what the difference is between the brackets [] and
quotation marks "" ? When should I use one or another...

Thanks,

Art

----------------------------
Nikos Yannacopoulos said:
OK, you're close. The default value property is the correct place to do it,
and the DMax function approach is correct, just a minor sybtax flaw! Try:

DMax("[RefNo]", "tbl_Quote")+1

and it will do the job.

HTH,
Nikos

awm said:
Thanks Nikos. Yes I want to develop a form that would provide a new
sequential number as you assumed. On the form, I have a control [RefNo]
that is bound to the underlying table tbl_Quote.RefNo. I have also added
the following formula in the default of the [RefNo] control on the form:
DMax([RefNo], "tbl_Quote")+1. The problem is that when the form is opened
to add a new record, a #Error message appears on the control. I will not
assign a value to the form using the formula or to the underlying table.

Any ideas how to correct?

Thanks.



I'm afraid you are not clear enough. What are you trying to achieve?

Do you want to store in your table the sequential numbers in the imported
file, but also be able to add a record manually through a form, and give
it
a new sequential number automatically through the form? If that's the
case,
then yes, the DMax is the way; put your DMax expression in the default
value
property of the control in the form which is bound to the pertinent table
field.

If you are trying to do something else, please explain.

HTH,
Nikos

I have a table where I would like not to use an AutoNumber since I am
importing a file with approx. 1000 sequential numbers. When a new
record
is
added, I would like to use a DMax formula to create the next sequential
number.

I have tried to develop a form using all the entities of the table
however
I
cannot "assign a value to the object" when I have tried to create
a
DMax
formula to use the highest number in the table +1.

Am I approaching this the wrong way? Should I be using macros and
queries
to create a new sequential number and append the table with the new
record,
or is there a better way to do this?

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