Re: Using String Variables

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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 name
of
the
table I want to run DMax on but it will not work with or without the
quotes.

"Joshua A. Booker" wrote:

Jim,

If I understand properly, [HistoryTableValue] is a field that
contains
the
name of the table you want to do the DMax on. If so, lose the quotes
around
it 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
the
next available number from 1 of 5 tables. "HistoryTableValue" has
the
correct
table name in it but when I use it in a macro I get an action
failed
notice,
If I put in a table name it works.


Format(Now(),"yy") & "-" &
(DMax("[number]","[HistoryTableValue]")+1)








.



Relevant Pages

  • Re: Using String Variables
    ... Yes the field contains the proper name, I had it appear on the first form to ... "Joshua A. Booker" wrote: ... bound to the HistoryTableValue field? ...
    (microsoft.public.access.modulesdaovba)
  • Re: Simple high-ascii character encoding
    ... >> You cannot write even English correctly using ASCII only. ... > apostrophes and single quotes need to look different. ... apostrophes are not quote marks (neither are ... even the letters have proper ways of being drawn. ...
    (comp.infosystems.www.authoring.html)
  • Re: Collapse of the WTC
    ... You gave me quotes out of contex, edited, wherein the good Dr suggests ... safety engineers, also encouraged his audience of fellow researchers ... proper way," he said. ...
    (rec.music.classical.guitar)
  • Re: Humiliation redefined
    ... quotes and learn from it. ... It is only proper to join agroup and go with ... I did in fact notice that *you* are the only one I've seen posting ...
    (sci.med.transcription)
  • Re: I feel awful
    ... I've seen it most often in the closing of a letter (mostly in letters ... The OED quotes Shelley, ... Does historical use make it a "proper" contraction? ...
    (alt.usage.english)