Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is Status in VBA

Status
Not open for further replies.

ainemc76

Programmer
May 31, 2007
6
0
0
IE
Hi

Can anyone help, I am new at being a DBA and I am trying to adapt code for an audit trail in one on my DB's. I am getting a byRef type mismatch error on one of the lines. I know I need to declare what status is but I don't know what status is!!

Here is copy of code:
Option Compare Database
Dim bWasNewRecord As Boolean

Private Sub Form_AfterUpdate()
Call AuditEditEnd("Table Haematology Results-All Sites", "audTmpHaemo", "audHaemo", "Index", Nz(Me.Index, 0), bWasNewRecord)
End Sub

Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
Call AuditDelEnd("audTmpHaemo", "audFupHaemo", status)
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)
bWasNewRecord = Me.NewRecord
Call AuditEditBegin("Table Haematology Results-All Sites", "audTmpHaemo", "Index", Nz(Me.Index, 0), bWasNewRecord)
End Sub

Private Sub Form_Delete(Cancel As Integer)
Call AuditDelBegin("Table Haematology Results-All Sites", "audTmpHaemo", "Index", Nz(Me.Index, 0))
End Sub

Thanks :)
 
You need to post the line that is causing the error and at least the sub or function line that is being called:

Sub/Function AuditDelBegin(TableName As String, ... ? ...)
 
You might also try doing a search throughout the "entire project" for "status" to see if it's listed elsewhere - in another module/sub/function. It could be a public variable that wasn't identified correctly..

And to help, we definitely need to see the code for the function, AuditDelBegin (as already stated).

--

"If to err is human, then I must be some kind of human!" -Me
 
What is the code declaring the AuditDelEnd procedure ?


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi Everyone,

Thanks for replying. If it helps to see all the code in its entirety, you can view the code on this link and the 'step by step' function is on this link I am adapting the code through access form properties and choosing event procedure on 'onDelete', 'afterDelConfirm', 'BeforeUpdate' (this is the problem line) and 'afterUpdate'. I have 8 tables in the form 1 main table and 7 subfomrs, the same code is replicated throughout with only table names changed. The code is compling everywhere else.

Here is the actual line of code that is causing problems:
Code:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
    Call AuditDelEnd("audTmpHaemo", "audFupHaemo", status)
End Sub

I'm sorry if I'm giving too little/too much info. I'm just unsure of what to do. Thanks again for answering i feel like I'm in VBA wasteland and was even dreaming of it last night! :)
 
This is the required line:

[tt]Function AuditDelEnd(sAudTmpTable As String, sAudTable As String, [blue]Status As Integer[/blue]) As Boolean[/tt]

Either
[tt]Dim status As Integer
status =1[/tt]

Or
[tt]Call AuditDelEnd("audTmpHaemo", "audFupHaemo", 1)[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top