Error 438 on .requery line in code

C

Cyberwolf

Hi all,

I am getting an error 438 on the me![GroupID].Requery line of the following
code. Can anyone tell me why?

Private Sub Group_DblClick(Cancel As Integer)

Dim lngGroupID

' On Error GoTo Group_DblClick_Error

If IsNull(Me![GroupID]) Then
Me![GroupID] = ""
Else
lngGroupID = Me![GroupID]
Me![GroupID] = Null
End If
DoCmd.OpenForm "frm_Groups", , , , , acDialog, "GotoNew"
Me![GroupID].Requery
If lngGroupID <> 0 Then Me![GroupID] = lngGroupID


On Error GoTo 0
Exit Sub

Group_DblClick_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Group_DblClick of VBA Document Form_frm_EmailAddresses"
End Sub
 
C

Cheese_whiz

Hi Cyberwolf,

Try replacing the 'Me' in the requery line with a more complete reference to
your original form's name:

Forms!YourFormName!GroupID.Requery

HTH,
CW
 
C

Cheese_whiz

Hi Cyber,

The other issue that often pops up is if you have your control name the same
thing as the data it holds. If you do, change teh control name to something
like txtGroupID.

CW

Cheese_whiz said:
Hi Cyberwolf,

Try replacing the 'Me' in the requery line with a more complete reference to
your original form's name:

Forms!YourFormName!GroupID.Requery

HTH,
CW

Cyberwolf said:
Hi all,

I am getting an error 438 on the me![GroupID].Requery line of the following
code. Can anyone tell me why?

Private Sub Group_DblClick(Cancel As Integer)

Dim lngGroupID

' On Error GoTo Group_DblClick_Error

If IsNull(Me![GroupID]) Then
Me![GroupID] = ""
Else
lngGroupID = Me![GroupID]
Me![GroupID] = Null
End If
DoCmd.OpenForm "frm_Groups", , , , , acDialog, "GotoNew"
Me![GroupID].Requery
If lngGroupID <> 0 Then Me![GroupID] = lngGroupID


On Error GoTo 0
Exit Sub

Group_DblClick_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Group_DblClick of VBA Document Form_frm_EmailAddresses"
End Sub

--
Cyberwolf
Finder of Paths, Hunter of Prey
Ghost of the Night, Shadow of Day
The Wolf
 
D

Dirk Goldgar

Cyberwolf said:
Hi all,

I am getting an error 438 on the me![GroupID].Requery line of the
following
code. Can anyone tell me why?

Private Sub Group_DblClick(Cancel As Integer)

Dim lngGroupID

' On Error GoTo Group_DblClick_Error

If IsNull(Me![GroupID]) Then
Me![GroupID] = ""
Else
lngGroupID = Me![GroupID]
Me![GroupID] = Null
End If
DoCmd.OpenForm "frm_Groups", , , , , acDialog, "GotoNew"
Me![GroupID].Requery
If lngGroupID <> 0 Then Me![GroupID] = lngGroupID


On Error GoTo 0
Exit Sub

Group_DblClick_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Group_DblClick of VBA Document Form_frm_EmailAddresses"
End Sub



What is GroupID? Is that actually the name of a control on your form, or is
it only the name of a field in your form's recordsource? If it's the name
of a field in the recordsource, but not the name of a control on the form,
you'll get this error.
 
D

Dirk Goldgar

Cheese_whiz said:
Hi Cyber,

The other issue that often pops up is if you have your control name the
same
thing as the data it holds. If you do, change teh control name to
something
like txtGroupID.

There is nothing wrong with having a control named the same as the field to
which it is bound. It will not *ever* cause an error. (Having a control
with the same name as a field, but not bound to that field, does cause
errors.)
 
C

Cheese_whiz

Hi DG,

I thought I had run into problems with that before, but maybe not. I
appreciate teh clarification.

CW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top