Tupacmoche
Registered User.
- Local time
- Today, 09:10
- Joined
- Apr 28, 2008
- Messages
- 291
I have a tried and true macro that calls 10 queries and has been running perfectly for years. It runs three delete queries followed by six other queries that populate the tables that were deleted. Now to the issue/problem. I want to add to the top of this macro VBA code as follows:
Option Compare Database
Public Sub LocRec()
Dim user As String
user = GetUserName()
If Forms("BuyBack menu f").RecordLocks = 1 Then
MsgBox ("Try later records are locked now " & user)
Else
MsgBox ("You can access records now " & user)
Forms("BuyBack menu f").RecordLocks = 1
End If
End Sub
Basically, it checks if the table/form is locked. If it is it should exit out and not run any of the 10 openQueries that follow it. But, if it is not locked, it should lock the records for the current users and run the balance of the queries.
I have added a 'RunCode' Action with the following Action Arguments :
Function IsFileLocked()
Call LockRec()
End Function
this is meant to call the above VBA code but I get the following error:
"You tried to run a Visual Basic procedure to set a property or method for an object. However, the component doesn't make the property or method available for Automation operations."
What is wrong? How can this be fixed?:banghead:
Option Compare Database
Public Sub LocRec()
Dim user As String
user = GetUserName()
If Forms("BuyBack menu f").RecordLocks = 1 Then
MsgBox ("Try later records are locked now " & user)
Else
MsgBox ("You can access records now " & user)
Forms("BuyBack menu f").RecordLocks = 1
End If
End Sub
Basically, it checks if the table/form is locked. If it is it should exit out and not run any of the 10 openQueries that follow it. But, if it is not locked, it should lock the records for the current users and run the balance of the queries.
I have added a 'RunCode' Action with the following Action Arguments :
Function IsFileLocked()
Call LockRec()
End Function
this is meant to call the above VBA code but I get the following error:
"You tried to run a Visual Basic procedure to set a property or method for an object. However, the component doesn't make the property or method available for Automation operations."
What is wrong? How can this be fixed?:banghead: