473,486 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

audit trail code and VBA nameing conventions

Morning,

I've managed to successfully pop the Ausit Trail code from Allen
Browne into a couple of files now with great success. However, a new
file I have been modifying is causing me some furstration. So far,
all the tables in any of the files I have been working with have been
named with either no spaces of have included the _ as part of the file
name.

The table (which I did not name) causing me the greif is named
"NCF_Table New" which VBA is having a hissy fit with due to the
space. As I have never had to do it before, how do you make VBA
accept names with spaces such as this. Forms I understand in VBA as
they are in the [...] - is VBA the same way for tables? I do not want
to have to rename the table as this table is included in quite a
sustantial number of SQL and other queries and in forms and reports.

Hopefully as simple q from simple bloke ;-)

Stinky Pete ;-)

Mar 26 '07 #1
7 2575
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
pl*****************@msn.com
Mar 27 '07 #2
On Mar 27, 10:09 am, "Albert D. Kallal"
<PleaseNOOOsPAMmkal...@msn.comwrote:
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...@msn.com
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,

Stinky Pete ;-)

Mar 27 '07 #3
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.

"Stinky Pete" <Pe**********@symbionhealth.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
On Mar 27, 10:09 am, "Albert D. Kallal"
<PleaseNOOOsPAMmkal...@msn.comwrote:
>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...@msn.com

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,

Stinky Pete ;-)
Mar 27 '07 #4
There is a utility program called "Find and Replace" by Rick Fisher
Consulting.
http://www.rickworld.com/
"Stinky Pete" <Pe**********@symbionhealth.comwrote in message
news:11*********************@p77g2000hsh.googlegro ups.com...
Morning,

I've managed to successfully pop the Ausit Trail code from Allen
Browne into a couple of files now with great success. However, a new
file I have been modifying is causing me some furstration. So far,
all the tables in any of the files I have been working with have been
named with either no spaces of have included the _ as part of the file
name.

The table (which I did not name) causing me the greif is named
"NCF_Table New" which VBA is having a hissy fit with due to the
space. As I have never had to do it before, how do you make VBA
accept names with spaces such as this. Forms I understand in VBA as
they are in the [...] - is VBA the same way for tables? I do not want
to have to rename the table as this table is included in quite a
sustantial number of SQL and other queries and in forms and reports.

Hopefully as simple q from simple bloke ;-)

Stinky Pete ;-)

Mar 27 '07 #5
On Mar 27, 12:53 pm, "Don Leverton"
<leveriteNoJunkM...@telusplanet.netwrote:
There is a utility program called "Find and Replace" by Rick Fisher
Consulting.http://www.rickworld.com/

"Stinky Pete" <Peter.Mor...@symbionhealth.comwrote in message

news:11*********************@p77g2000hsh.googlegro ups.com...
Morning,
I've managed to successfully pop the Ausit Trail code from Allen
Browne into a couple of files now with great success. However, a new
file I have been modifying is causing me some furstration. So far,
all the tables in any of the files I have been working with have been
named with either no spaces of have included the _ as part of the file
name.
The table (which I did not name) causing me the greif is named
"NCF_Table New" which VBA is having a hissy fit with due to the
space. As I have never had to do it before, how do you make VBA
accept names with spaces such as this. Forms I understand in VBA as
they are in the [...] - is VBA the same way for tables? I do not want
to have to rename the table as this table is included in quite a
sustantial number of SQL and other queries and in forms and reports.
Hopefully as simple q from simple bloke ;-)
Stinky Pete ;-)
Hi all,

Well, I've been popping square brackets as and where needed, however I
am still coming unstuck. Each time I make a record change in the form
the app halts and I fire off to the VBA error thingy. I'm going to
have a good look at all my syntax and typing to make sure I have not
made any silly mistakes and will pop a note back if I am still stuck.

Thanx once again for all the feedback and comments. I have again
learnt heaps although it might be a while as Optusnet are arguing with
my Visa card.

Stinky Pete ;-)

Mar 30 '07 #6
On Mar 27, 12:03 pm, "Allen Browne" <AllenBro...@SeeSig.Invalid>
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...@symbionhealth.comwrote in message

news:11**********************@e65g2000hsc.googlegr oups.com...
On Mar 27, 10:09 am, "Albert D. Kallal"
<PleaseNOOOsPAMmkal...@msn.comwrote:
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...@msn.com
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 ;-)

Apr 16 '07 #7
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" <Pe**********@symbionhealth.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
On Mar 27, 12:03 pm, "Allen Browne" <AllenBro...@SeeSig.Invalid>
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...@symbionhealth.comwrote in message

news:11**********************@e65g2000hsc.googleg roups.com...
On Mar 27, 10:09 am, "Albert D. Kallal"
<PleaseNOOOsPAMmkal...@msn.comwrote:
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...@msn.com
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 ;-)
Apr 16 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7185
by: Raphael Gluck | last post by:
Hi, Is it possible for one to program one's pages as such that when a database table is updated over the web, via a form, that an e-mail confirmation is sent to a specified address, notifying...
2
1889
by: Keith | last post by:
Hi I am developing an ASP application which will interact with a SQL database. A requirement of the application is that there is a full audit trail of any modifications to data. I am...
2
2252
by: Zlatko Matić | last post by:
I tried to implement triggers for filling audit-trail table on this way. Everything works fine as long as I don't update the primary key field value. When I try to update PK value, an error...
3
6255
by: Zlatko Matić | last post by:
Hello. I tried to implement audit trail, by making an audit trail table with the following fileds: TableName,FieldName,OldValue,NewValue,UpdateDate,type,UserName. Triggers on each table were...
6
5824
by: Parag | last post by:
Hello, I have been assigned the task to design the audit trail for the ASP.NET web application. I don't know what the best practices for such audit trails are. Our application one dedicated user...
3
3767
by: hary08 | last post by:
im doing a database for Hospital Admission, I have a log in form which prompt user for a password. The source of log in is to look for the values in my Table tblEmployees and match user name and...
2
3171
by: rockdc1981 | last post by:
I dont it is possible to put this codes together.. I want to prompt the user to save the record and at the same time have a log of audit trail. the codes work out fine separately. Code for Audit...
6
2717
by: babamc4 | last post by:
I have a main form (mainformlung) with 5 subforms (followupacute, followuplate, biochemresults, haemresults and pftresults). I have copied Allen Browne's Audit Trail code (thanks to Allen Browne)...
16
3532
by: zandiT | last post by:
hello i'm using the microsoft audit trail example ACC2000: How to Create an Audit Trail of Record Changes in a Form and im having a problem with my recordset. in the example they are using a...
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5430
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.