 |
| Access VBA Discuss using VBA for Access programming. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 18th, 2006, 04:28 AM
|
|
Registered User
|
|
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Run Time Error 424 "Object Required"
I wondered if someone could help.
I am running a report within Access and have set up a label within the detail line to list all results by sequence no.
The code I am using is:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
xx = xx + 0
LblSeqNo.Caption = CStr(xx)
If Movement = 1 Then
Movement.Visible = True
Else
Movement.Visible = False
End If
End Sub
But receive the error: Run Time Error 424 "Object Required" in debug this refers to my second movement line.
Can anyone help?
thanks
Paul
|
|

May 18th, 2006, 06:45 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
What object does "Movement" refer to? That seems to be missing. (scratching head). I am not understanding your code.
You should also be declaring your variables.
mmcdonal
|
|

May 18th, 2006, 08:28 AM
|
|
Registered User
|
|
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Movement refers to the function. I have just add a dimension to the variable:
Dim xx As Integer
But still 424 error refers to missing object: Movement
|
|

May 18th, 2006, 08:59 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
But when you write "Movement.Visible" you are referring to some object on the report called Movement, not the function.
If you want to call the Function, you need to call it from a text box, it seems to me.
mmcdonal
|
|

May 18th, 2006, 09:03 AM
|
|
Registered User
|
|
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have dimensioned the Integar.
Movement is in fact a variable. When I run the code I now recieve an error: Variable Not Defined.
Option Compare Database
Option Explicit
Dim xx As Long
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
xx = xx + 1
LblSeqNo.Caption = CStr(xx)
If Movement = 0 Then
Movement.Visible = False
Else
Movement.Visible = True
End If
End Sub
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
xx = 0
End Sub
|
|

May 18th, 2006, 09:09 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
You can't make a variable visible or not. The reason it is throwing an error on the Else condition is that Movement does not = 1, so the first condition is skipped. Then it gets to the second condition and it can't make a variable visible. What you want to do is to make the control on the report visible or not depending on the value of the variable, not make the variable itself visible or not. The variable does not have a property of Visible, but the control does.
So if Movement is displayed in the text box called txtMove, then you would write this as:
Me.txtMove = Movement
If Movement = 1 Then
Me.txtMove.Visible = True
Else
Me.txtMove.Visible = False
End If
Does this work?
mmcdonal
|
|

May 19th, 2006, 03:00 AM
|
|
Registered User
|
|
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your reply.
I have run the following code:
Option Compare Database
Option Explicit
Dim xx As Long
Private Sub Detail_Format(Cancel As Integer, Movement As Integer)
xx = xx + 1
LblSeqNo.Caption = CStr(xx)
Me.txtMove = Movement
If Movement = 1 Then
Me.txtMove.Visible = True
Else
Me.txtMove.Visible = False
End If
End Sub
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
xx = 0
End Sub
and receive an error: Compile Error:Method or Data Member Not Found
|
|

May 19th, 2006, 06:22 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
I think you will find that "txtMove" is the issue. I put this generic control name in the code as an example. You have to have a control in which you are displaying the results of your function, and whatever that control's name is, is the name you use in your code. Unless you have a control named "txtMove" on your report, the code won't work.
HTH
mmcdonal
|
|

October 31st, 2010, 04:49 PM
|
|
Registered User
|
|
Join Date: Oct 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Run Time Error 424 "Object Required"
Hi,
You will usually encounter Runtime Error 424 when trying to use Microsoft Office Chart and Microsoft Access 200 at the same time. The solution is easy â just uninstall Internet Explorer 6.0. Instead, try using Mozilla Firefox or Opera. These are excellent choices for web browsers and they do not clash with MS Chart or MS Access. Of course, you can try and avoid using MS Chart and MS Access at the same time, but this isn't always possible. If you do choose to go this route, click on the chart and select "property toolbox."
GODSPEED.. 
|
|
 |