Object required (Error 424)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If a particular field on a particular form is blank, I need to do one thing.
If that field has something in it, I need to do one thing and then I need to
do one more thing. I messed up.

The offending portion of the code below apparently has to do with
referencing the blank field. When I run this, it breaks at the first If,
telling me to provide a valid object qualifier. Well, lo and behold, if I
scroll my cursor over the bad code, it tells me that it recognizes the field
is indeed blank, so I must have qualified the object with validitiliness.

(The only addition to the existing code is the If Then statement. The SQL
works, the DoCmd works, even
"Forms!frmTransmittals!frmTransmittalsData.Form.Requery" works, although I
think that's an awkward was to word the request, this is how Access
apparently wants it.)

Private Sub cmdUpdateTemp_Click()
Dim MySQL As String
MySQL = "DO THIS THING"
DoCmd.RunSQL MySQL
If [Forms]![frmTransmittals]![txtNewTRNum] Is Null Then
Forms!frmTransmittals!frmTransmittalsData.Form.Requery
ElseIf [Forms]![frmTransmittals]![txtNewTRNum] Is Not Null Then
MySQL = "NOW DO THIS DIFFERENT THING"
DoCmd.RunSQL MySQL
Forms!frmTransmittals!frmTransmittalsData.Form.Requery
End If
End Sub
 
Is Null is for SQL: try using the IsNull function:

If IsNull([Forms]![frmTransmittals]![txtNewTRNum]) Then
 
Stop being so modest, Doug. You are a true American Hero.

It works beautifully, and I feel silly for having even asked.

Thnx!
Dale

Douglas J Steele said:
Is Null is for SQL: try using the IsNull function:

If IsNull([Forms]![frmTransmittals]![txtNewTRNum]) Then



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


dlerh said:
If a particular field on a particular form is blank, I need to do one thing.
If that field has something in it, I need to do one thing and then I need to
do one more thing. I messed up.

The offending portion of the code below apparently has to do with
referencing the blank field. When I run this, it breaks at the first If,
telling me to provide a valid object qualifier. Well, lo and behold, if I
scroll my cursor over the bad code, it tells me that it recognizes the field
is indeed blank, so I must have qualified the object with validitiliness.

(The only addition to the existing code is the If Then statement. The SQL
works, the DoCmd works, even
"Forms!frmTransmittals!frmTransmittalsData.Form.Requery" works, although I
think that's an awkward was to word the request, this is how Access
apparently wants it.)

Private Sub cmdUpdateTemp_Click()
Dim MySQL As String
MySQL = "DO THIS THING"
DoCmd.RunSQL MySQL
If [Forms]![frmTransmittals]![txtNewTRNum] Is Null Then
Forms!frmTransmittals!frmTransmittalsData.Form.Requery
ElseIf [Forms]![frmTransmittals]![txtNewTRNum] Is Not Null Then
MySQL = "NOW DO THIS DIFFERENT THING"
DoCmd.RunSQL MySQL
Forms!frmTransmittals!frmTransmittalsData.Form.Requery
End If
End Sub
 
Um, thanks, except check my e-mail. See the canada.com in it? <g>

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


dlerh said:
Stop being so modest, Doug. You are a true American Hero.

It works beautifully, and I feel silly for having even asked.

Thnx!
Dale

Douglas J Steele said:
Is Null is for SQL: try using the IsNull function:

If IsNull([Forms]![frmTransmittals]![txtNewTRNum]) Then



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


dlerh said:
If a particular field on a particular form is blank, I need to do one thing.
If that field has something in it, I need to do one thing and then I
need
to
do one more thing. I messed up.

The offending portion of the code below apparently has to do with
referencing the blank field. When I run this, it breaks at the first If,
telling me to provide a valid object qualifier. Well, lo and behold, if I
scroll my cursor over the bad code, it tells me that it recognizes the field
is indeed blank, so I must have qualified the object with validitiliness.

(The only addition to the existing code is the If Then statement. The SQL
works, the DoCmd works, even
"Forms!frmTransmittals!frmTransmittalsData.Form.Requery" works, although I
think that's an awkward was to word the request, this is how Access
apparently wants it.)

Private Sub cmdUpdateTemp_Click()
Dim MySQL As String
MySQL = "DO THIS THING"
DoCmd.RunSQL MySQL
If [Forms]![frmTransmittals]![txtNewTRNum] Is Null Then
Forms!frmTransmittals!frmTransmittalsData.Form.Requery
ElseIf [Forms]![frmTransmittals]![txtNewTRNum] Is Not Null Then
MySQL = "NOW DO THIS DIFFERENT THING"
DoCmd.RunSQL MySQL
Forms!frmTransmittals!frmTransmittalsData.Form.Requery
End If
End Sub
 
How about a true North American Hero?

(BTW, ya'll need to drop Quebec 'fore we'uns can allow ya to join the Union;-)

Douglas J Steele said:
Um, thanks, except check my e-mail. See the canada.com in it? <g>

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


dlerh said:
Stop being so modest, Doug. You are a true American Hero.

It works beautifully, and I feel silly for having even asked.

Thnx!
Dale

Douglas J Steele said:
Is Null is for SQL: try using the IsNull function:

If IsNull([Forms]![frmTransmittals]![txtNewTRNum]) Then



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


If a particular field on a particular form is blank, I need to do one
thing.
If that field has something in it, I need to do one thing and then I need
to
do one more thing. I messed up.

The offending portion of the code below apparently has to do with
referencing the blank field. When I run this, it breaks at the first If,
telling me to provide a valid object qualifier. Well, lo and behold, if I
scroll my cursor over the bad code, it tells me that it recognizes the
field
is indeed blank, so I must have qualified the object with validitiliness.

(The only addition to the existing code is the If Then statement. The SQL
works, the DoCmd works, even
"Forms!frmTransmittals!frmTransmittalsData.Form.Requery" works, although I
think that's an awkward was to word the request, this is how Access
apparently wants it.)

Private Sub cmdUpdateTemp_Click()
Dim MySQL As String
MySQL = "DO THIS THING"
DoCmd.RunSQL MySQL
If [Forms]![frmTransmittals]![txtNewTRNum] Is Null Then
Forms!frmTransmittals!frmTransmittalsData.Form.Requery
ElseIf [Forms]![frmTransmittals]![txtNewTRNum] Is Not Null Then
MySQL = "NOW DO THIS DIFFERENT THING"
DoCmd.RunSQL MySQL
Forms!frmTransmittals!frmTransmittalsData.Form.Requery
End If
End Sub
 
Back
Top