Re: audit trail code and VBA nameing conventions



Yes, that's correct.

Include the square brackets around the name if it contains a space or other odd character.

Do this for the table, the temp table, and the key field name.

The last argument is a number, so you don't use the square brackets there.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Stinky Pete" <Peter.Morris@xxxxxxxxxxxxxxxxx> wrote in message news:1176704949.078405.105730@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mar 27, 12:03 pm, "Allen Browne" <AllenBro...@xxxxxxxxxxxxxx>
wrote:
Include square brackets around the name that contains a space, e.g.:
Call AuditDelBegin("[tblInvoice]", ...

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"StinkyPete" <Peter.Mor...@xxxxxxxxxxxxxxxxx> wrote in message

news:1174956335.079113.114840@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



> On Mar 27, 10:09 am, "Albert D. Kallal"
> <PleaseNOOOsPAMmkal...@xxxxxxx> wrote:
>> You will have to show the context of how you are using the table name
>> that
>> fails.

>> if you using the tables collection, then

>> currentdb.tabledefs("NCF_Table New") should work fine.

>> Post the one line of code you have that is failing....

>> --
>> Albert D. Kallal (Access MVP)
>> Edmonton, Alberta Canada
>> pleaseNOOSpamKal...@xxxxxxx

> Albert, fair comment.

> Anyway, the first line where this fails is

> Function AuditDelBegin("NCF_Table New" As String, aud_Scales_tmp_tbl
> As String, ID As String, lngKeyValue As Long) As Boolean

> which is called from

> Call AuditDelBegin("NCF_Table New", "aud_NCF_tmp_tbl", "ID", Nz(Me.ID,
> 0), bWasNewRecord)

> but the code also have lines such as

> "SELECT 'Delete' AS Expr1, Now() AS Expr2, NetworkUserName() AS Expr3,
> " & NCF_Table New & ".* " & _

> that I need to fix up as well.

>>From what I read in your intial post, it seems (and I hope) that I
> need to declare the table name. Am i close??

> Regards,

>StinkyPete;-)- Hide quoted text -

- Show quoted text -

Hi Allen,

Well, I am getting there after a forced abscence. I have made the
corrections to the relevant sections of the form as you mentioned
above. Howvever, the code keeps on failing each time as it reckons an
expected identifier is not correct in the Function. I have changed
the Forms Call and Module Function code as follows:

Call AuditDelBegin("[NCR_Table New]", ....

Function AuditDelBegin("[NCR_Table New]" As String, .....

From my simple understanding, in the Function, does the table name
with a spece need to be in aquare brackets as per the the forms Call
syntax? I'm asking as that is where the compiler always indicated the
expected identifier is wrong.

Regards,

Stinky Pete ;-)


.



Relevant Pages

  • Re: Syntax error in insert statement?
    ... What is your code that executes this statement? ... >> into square brackets. ... >> Val Mazur ... >> Microsoft MVP ...
    (microsoft.public.data.ado)
  • Re: Sum of text fields?
    ... Allen Browne - Microsoft MVP. ... >> Allen Browne - Microsoft MVP. ... >>> there is a missing separator or ")". ... >>>> Remove the square brackets. ...
    (microsoft.public.access.queries)
  • Re: Stop me before I use DSN again!
    ... or just get into the habit of using those square brackets! ... Kevin Spencer ... Microsoft MVP ...
    (microsoft.public.frontpage.client)
  • Re: datepart error
    ... With the square brackets, Access is looking for a field with that name, whereas Dateis a VBA function. ... Depending on the context, you may need to use a comma as the list separator. ... Tips for Access users - http://allenbrowne.com/tips.html ...
    (microsoft.public.access.formscoding)

Loading