Re: Using String Variables
- From: "Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx>
- Date: Tue, 4 Apr 2006 18:54:56 -0400
None of the approaches that have quotes around the field name are going to
work.
Are you certain that the field contains the proper table name? Are you sure
that the table has data in it (so that DMax has something to return)?
I just did a quick test, and had no problem.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Jim T." <JimT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:026DCA84-32D9-43EF-A2EE-8E97C4917184@xxxxxxxxxxxxxxxx
This Works:
Format(Now(),"yy") & "-" & (DMax("[number]","Birdsall_History_Table")+1)
These do not work:
Format(Now(),"yy") & "-" & (DMax("[number]","[HistoryTableValue]")+1)
Format(Now(),"yy") & "-" & (DMax("[number]",[HistoryTableValue])+1)
Format(Now(),"yy") & "-" & (DMax("[number]",
[Forms]![Switchboard]![HistoryTableValue])+1)
Format(Now(),"yy") & "-" & (DMax("[number]",
[Forms]![Switchboard].[HistoryTableValue])+1)
Format(Now(),"yy") & "-" & (DMax("[number]",
[Forms]![Switchboard]![HistoryTableValue].Value)+1)
Format(Now(),"yy") & "-" & (DMax("[number]",
[Forms]![Switchboard].[HistoryTableValue].Value)+1)
Format(Now(),"yy") & "-" & (DMax("[number]",
[Forms]![Switchboard]![HistoryTableValue].[Value])+1)
Format(Now(),"yy") & "-" &
(DMax("[number]","[Forms]![Switchboard]![HistoryTableValue].[Value]")+1)
Format(Now(),"yy") & "-" & (DMax("[number]",
"[Forms]![Switchboard]![HistoryTableValue]")+1)
Format(Now(),"yy") & "-" & (DMax("[number]",
"[Forms]![Switchboard].[HistoryTableValue]")+1)
Format(Now(),"yy") & "-" & (DMax("[number]",
"[Forms]![Switchboard]![HistoryTableValue].Value")+1)
Format(Now(),"yy") & "-" &
(DMax("[number]","[Table]![HistoryTableValue]")+1)
Format(Now(),"yy") & "-" & (DMax([HistoryTableValuel]![number])+1)
Format(Now(),"yy") & "-" & (DMax("[number]","[HistoryTableValue]")+1)
Format(Now(),"yy") & "-" &
(DMax("[number]","[Tables]![HistoryTableValue]")+1)
Format(Now(),"yy") & "-" &
(DMax("[number]",[Tables]![HistoryTableValue])+1)
Format(Now(),"yy") & "-" & (DMax("[number]","[Tables].[HistoryTableValue]")+1)
Format(Now(),"yy") & "-" &
(DMax("[number]","[Tables]![HistoryTableValue].[Value]")+1)
"Joshua A. Booker" wrote:
Jim,
Perhaps the field name cannot be resolved in your context. I Just
noticed
you are doing this in a macro. Do you have a form open that has a field
bound to the HistoryTableValue field? If so, try preceding it with the
form
name that it's from.
Format(Now(),"yy") & "-" & (DMax("[number]",
Forms!FormName![HistoryTableValue])+1)
HTH,
Josh
"Jim T." <JimT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F229E3DC-D1DE-4F06-BBA8-57D9EB740EF6@xxxxxxxxxxxxxxxx
That is correct [HistoryTableValue] is a field that contains the namethe
of
table I want to run DMax on but it will not work with or without thequotes.
the
"Joshua A. Booker" wrote:
Jim,
If I understand properly, [HistoryTableValue] is a field that
contains
aroundname of the table you want to do the DMax on. If so, lose the quotes
theit like this:
Format(Now(),"yy") & "-" & (DMax("[number]",[HistoryTableValue])+1)
HTH,
Josh
"Jim T." <JimT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8ADA1AC6-644E-4BF4-90DD-26357E01442D@xxxxxxxxxxxxxxxx
I am transferring infomation from one form to another and need to
get
next available number from 1 of 5 tables. "HistoryTableValue" hascorrect
the
table name in it but when I use it in a macro I get an actionnotice,
failed
If I put in a table name it works.
Format(Now(),"yy") & "-" &
(DMax("[number]","[HistoryTableValue]")+1)
.
- Follow-Ups:
- Re: Using String Variables
- From: Jim T.
- Re: Using String Variables
- References:
- Re: Using String Variables
- From: Joshua A. Booker
- Re: Using String Variables
- From: Joshua A. Booker
- Re: Using String Variables
- From: Jim T.
- Re: Using String Variables
- Prev by Date: Re: Access 2000 - Loop through a Memo field with VBA
- Next by Date: Re: Combining text and variables in a string???
- Previous by thread: Re: Using String Variables
- Next by thread: Re: Using String Variables
- Index(es):
Relevant Pages
|