Max value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to do following. Search which is the biggest value in table's
autonumber field and write the value in same tables "F1" field in every
record. Might sound little bit stupid but I need this value for another
program.
 
not that hard. To get the biggest values:
lngBigVal = dmax([AutoNumberFieldName],"TableName")
To Update:
create an update query to put the number in F1
 
Sam,

You will have to call the query from code or use an SQL execute statement.
I would need to know more to help, and I am pressed for time this morning.
Can you send more detail on how and where you are doing this?

Sam said:
Actually I have difficulties with query. I know how to put number with update
query but in this case I should put varible I really don't know how to do it.

Klatuu said:
not that hard. To get the biggest values:
lngBigVal = dmax([AutoNumberFieldName],"TableName")
To Update:
create an update query to put the number in F1

Sam said:
I want to do following. Search which is the biggest value in table's
autonumber field and write the value in same tables "F1" field in every
record. Might sound little bit stupid but I need this value for another
program.
 
Actually I have difficulties with query. I know how to put number with update
query but in this case I should put varible I really don't know how to do it.

Klatuu said:
not that hard. To get the biggest values:
lngBigVal = dmax([AutoNumberFieldName],"TableName")
To Update:
create an update query to put the number in F1

Sam said:
I want to do following. Search which is the biggest value in table's
autonumber field and write the value in same tables "F1" field in every
record. Might sound little bit stupid but I need this value for another
program.
 
Simple thing is that I have table with "ID" (Autonumber) and "F1" field.

I want to take the highest "ID" and place it in the "F1" field. The finding
highest is not problem anymore but placing it to F1 is not so simple because
the value is in variable. I tried to use following kind of structure for the
query.

SQL = "Table1" & _
" SET F1 = l " // l is an variable
DoCmd.RunSQL SQL

Klatuu said:
Sam,

You will have to call the query from code or use an SQL execute statement.
I would need to know more to help, and I am pressed for time this morning.
Can you send more detail on how and where you are doing this?

Sam said:
Actually I have difficulties with query. I know how to put number with update
query but in this case I should put varible I really don't know how to do it.

Klatuu said:
not that hard. To get the biggest values:
lngBigVal = dmax([AutoNumberFieldName],"TableName")
To Update:
create an update query to put the number in F1

:

I want to do following. Search which is the biggest value in table's
autonumber field and write the value in same tables "F1" field in every
record. Might sound little bit stupid but I need this value for another
program.
 
Actually I have difficulties with query. I know how to put number with
update query but in this case I should put varible I really don't know
how to do it.

UPDATE mytable AS outer
SET outer.wasteofspacefield =
( SELECT MAX(inner.counterfield)
FROM mytable AS inner
)



Hope that helps...


Tim F
 
Your query statement is incorrect.
i = result of DMax
strqry = "UPDATE Table1 SET Table1.F1 = "& i &";"
Currentdb.Execute stQry


Sam said:
Simple thing is that I have table with "ID" (Autonumber) and "F1" field.

I want to take the highest "ID" and place it in the "F1" field. The finding
highest is not problem anymore but placing it to F1 is not so simple because
the value is in variable. I tried to use following kind of structure for the
query.

SQL = "Table1" & _
" SET F1 = l " // l is an variable
DoCmd.RunSQL SQL

Klatuu said:
Sam,

You will have to call the query from code or use an SQL execute statement.
I would need to know more to help, and I am pressed for time this morning.
Can you send more detail on how and where you are doing this?

Sam said:
Actually I have difficulties with query. I know how to put number with update
query but in this case I should put varible I really don't know how to do it.

:

not that hard. To get the biggest values:
lngBigVal = dmax([AutoNumberFieldName],"TableName")
To Update:
create an update query to put the number in F1

:

I want to do following. Search which is the biggest value in table's
autonumber field and write the value in same tables "F1" field in every
record. Might sound little bit stupid but I need this value for another
program.
 
Back
Top