Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 18th, 2006, 04:28 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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


Reply With Quote
  #2 (permalink)  
Old May 18th, 2006, 06:45 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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
Reply With Quote
  #3 (permalink)  
Old May 18th, 2006, 08:28 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #4 (permalink)  
Old May 18th, 2006, 08:59 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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
Reply With Quote
  #5 (permalink)  
Old May 18th, 2006, 09:03 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #6 (permalink)  
Old May 18th, 2006, 09:09 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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
Reply With Quote
  #7 (permalink)  
Old May 19th, 2006, 03:00 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


Reply With Quote
  #8 (permalink)  
Old May 19th, 2006, 06:22 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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
Reply With Quote
  #9 (permalink)  
Old October 31st, 2010, 04:49 PM
Registered User
 
Join Date: Oct 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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..
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Object required - RTE 424 dbrother Access VBA 2 November 2nd, 2007 04:06 PM
My.Computer.Filesystem run-time 424 error insidertrader Beginning VB 6 2 September 27th, 2006 02:43 PM
Runtime Error 424: Object needed tobian Excel VBA 4 February 20th, 2006 09:41 AM
run time error: Object expected shoakat Classic ASP Databases 5 September 22nd, 2004 03:17 PM
error....Object required: '' sassenach Classic ASP Databases 2 August 4th, 2003 03:27 PM



All times are GMT -4. The time now is 09:31 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.