dbTalk Databases Forums  

Object Reuired error

comp.databases.ms-access comp.databases.ms-access


Discuss Object Reuired error in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
zufie
 
Posts: n/a

Default Object Reuired error - 07-27-2009 , 09:43 AM






When I click the Command Button to open a form I receive the error:
Object Reuired.

This form is a subform connected to a main form.

Any suggestions?

Thanks!

Zuf

Here is the code behind the Command Button:

Private Sub Command108_Click()
On Error GoTo Err_Command108_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmQuery5"

' stLinkCriteria = "[CallDate] Between [Forms]![Main]![Child89].
[Form]![txtBeginQAEvry5th] And [Forms]![Main]![Child89].[Form]!
[txtEndQAStopEvry5th]"
stLinkCriteria = "[CallDate] Between #" & txtBeginQAEvry5th.Value
& "# and #" & txtEndQAStopEvry5th.Value & "#"

DoCmd.OPENFORM stDocName, acNormal, , stLinkCriteria, acFormEdit

Exit_Command108_Click:
Exit Sub

Err_Command108_Click:
MsgBox Err.Description
Resume Exit_Command108_Click

End Sub

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Object Reuired error - 07-27-2009 , 11:35 AM






zufie wrote:
Quote:
When I click the Command Button to open a form I receive the error:
Object Reuired.

This form is a subform connected to a main form.

Any suggestions?

Thanks!

Zuf

Here is the code behind the Command Button:

Private Sub Command108_Click()
On Error GoTo Err_Command108_Click

Dim stDocName As String
Dim stLinkCriteria As String

'you could enter debug moder here to find out what line blows up by entering
STOP
'to step thru abd learn what line causes the error.
Quote:
stDocName = "frmQuery5"

' stLinkCriteria = "[CallDate] Between [Forms]![Main]![Child89].
[Form]![txtBeginQAEvry5th] And [Forms]![Main]![Child89].[Form]!
[txtEndQAStopEvry5th]"
stLinkCriteria = "[CallDate] Between #" & txtBeginQAEvry5th.Value
& "# and #" & txtEndQAStopEvry5th.Value & "#"

'you might want to know what's in this variable
MSGBOX stLinkCriteria

Quote:
DoCmd.OPENFORM stDocName, acNormal, , stLinkCriteria, acFormEdit

Exit_Command108_Click:
Exit Sub

Err_Command108_Click:
MsgBox Err.Description
Resume Exit_Command108_Click

End Sub

Reply With Quote
  #3  
Old   
zufie
 
Posts: n/a

Default Re: Object Reuired error - 07-27-2009 , 03:52 PM



On Jul 27, 11:35*am, Salad <o... (AT) vinegar (DOT) com> wrote:
Quote:
zufie wrote:
When I click the Command Button to open a form I receive the error:
Object Reuired.

This form is a subform connected to a main form.

Any suggestions?

Thanks!

Zuf

Here is the code behind the Command Button:

Private Sub Command108_Click()
On Error GoTo Err_Command108_Click

* * Dim stDocName As String
* * Dim stLinkCriteria As String

'you could enter debug moder here to find out what line blows up by entering
* * * * STOP
'to step thru abd learn what line causes the error.> * * stDocName = "frmQuery5"

' * *stLinkCriteria = "[CallDate] Between [Forms]![Main]![Child89].
[Form]![txtBeginQAEvry5th] And [Forms]![Main]![Child89].[Form]!
[txtEndQAStopEvry5th]"
* * stLinkCriteria = "[CallDate] Between #" & txtBeginQAEvry5th.Value
& "# and #" & txtEndQAStopEvry5th.Value & "#"

'you might want to know what's in this variable
* * * * MSGBOX stLinkCriteria



* * DoCmd.OPENFORM stDocName, acNormal, , stLinkCriteria, acFormEdit

Exit_Command108_Click:
* * Exit Sub

Err_Command108_Click:
* * MsgBox Err.Description
* * Resume Exit_Command108_Click

End Sub- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -


Here's how my code looks after I changed it:

I get a Syntax error regarding the line: stLinkCriteria = "[CallDate]
Between "#" &

Any ideas?

Thanks,

Zufie


Private Sub Command108_Click()
On Error GoTo Err_Command108_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmQuery5"

stLinkCriteria = "[CallDate]Between "#" &
[Forms]![Main]![Child89].[Form]![txtBeginQAEvry5th] = "#" And "#"
& ""
[Forms]![Main]![Child89].[Form]![txtEndQAStopEvry5th] = "#"

Debug.Print stLinkCriteria
Stop

DoCmd.OPENFORM stDocName, acNormal, , stLinkCriteria, acFormEdit

Exit_Command108_Click:
Exit Sub

Err_Command108_Click:
MsgBox Err.Description
Resume Exit_Command108_Click

End Sub

Reply With Quote
  #4  
Old   
Salad
 
Posts: n/a

Default Re: Object Reuired error - 07-27-2009 , 05:27 PM



zufie wrote:
Quote:
On Jul 27, 11:35 am, Salad <o... (AT) vinegar (DOT) com> wrote:

zufie wrote:

When I click the Command Button to open a form I receive the error:
Object Reuired.

This form is a subform connected to a main form.

Any suggestions?

Thanks!

Zuf

Here is the code behind the Command Button:

Private Sub Command108_Click()
On Error GoTo Err_Command108_Click

Dim stDocName As String
Dim stLinkCriteria As String

'you could enter debug moder here to find out what line blows up by entering
STOP
'to step thru abd learn what line causes the error.> stDocName = "frmQuery5"


' stLinkCriteria = "[CallDate] Between [Forms]![Main]![Child89].
[Form]![txtBeginQAEvry5th] And [Forms]![Main]![Child89].[Form]!
[txtEndQAStopEvry5th]"
stLinkCriteria = "[CallDate] Between #" & txtBeginQAEvry5th.Value
& "# and #" & txtEndQAStopEvry5th.Value & "#"

'you might want to know what's in this variable
MSGBOX stLinkCriteria




DoCmd.OPENFORM stDocName, acNormal, , stLinkCriteria, acFormEdit

Exit_Command108_Click:
Exit Sub

Err_Command108_Click:
MsgBox Err.Description
Resume Exit_Command108_Click

End Sub- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -




Here's how my code looks after I changed it:

I get a Syntax error regarding the line: stLinkCriteria = "[CallDate]
Between "#" &

Any ideas?

Thanks,

Zufie


Private Sub Command108_Click()
On Error GoTo Err_Command108_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmQuery5"

stLinkCriteria = "[CallDate]Between "#" &
[Forms]![Main]![Child89].[Form]![txtBeginQAEvry5th] = "#" And "#"
& ""
[Forms]![Main]![Child89].[Form]![txtEndQAStopEvry5th] = "#"

Debug.Print stLinkCriteria
Stop

DoCmd.OPENFORM stDocName, acNormal, , stLinkCriteria, acFormEdit

Exit_Command108_Click:
Exit Sub

Err_Command108_Click:
MsgBox Err.Description
Resume Exit_Command108_Click

End Sub
Sometimes I might have
On Error GoTo Err_Command108_Click
and temporarily I change it to
'On Error GoTo Err_Command108_Click
effectively disabling the error action.

I think you need to now what's the value of [txtBeginQAEvry5th] and
[txtEndQAStopEvry5th]. Most likely it's a reference problem. For
example, I might enter
msgbox [Forms]![Main]![Child89].[Form]![txtBeginQAEvry5th]
or
msgbox [Forms]![Main]![Child89].[Form]![txtEndQAEvry5th]
I guess your problem is with one or both of those controls.

Here's a handy link.
http://www.mvps.org/access/forms/frm0031.htm

Is your subform called Child89? Is that it's name?

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.