Oo Load Event

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

Guest

I have the following code and I have tried everything. Can anyone tell me why I get this error ont the OutDate field

"Method or Data member not found!"

This is the code...
Private Sub Form_Load()
Me.SoftwareID = Forms![frm-Software Media Library].[SoftwareID]
Me.Command33.Visible = False
Me.OutDate.SetFocus
'Forms!frm-SoftwareCheckoutHistory!OutDate.SetFocus
'frm-SoftwareCheckoutHistory!OutDate.SetFocus
End Sub
 
What is OutDate? A field in the form's recordset? A control on the form?
What type of control?

The error that you see indicates that either OutDate is not a control on the
form, or that OutDate is a control that does not have a SetFocus method
(such as a label).

--

Ken Snell
<MS ACCESS MVP>

Ronnie said:
I have the following code and I have tried everything. Can anyone tell me
why I get this error ont the OutDate field
"Method or Data member not found!"

This is the code...
Private Sub Form_Load()
Me.SoftwareID = Forms![frm-Software Media Library].[SoftwareID]
Me.Command33.Visible = False
Me.OutDate.SetFocus
'Forms!frm-SoftwareCheckoutHistory!OutDate.SetFocus
'frm-SoftwareCheckoutHistory!OutDate.SetFocus
End Sub
 
OutDate is a field that was draged from the field list to the form. I believe it makes it a control is that a correct.
--
Sincere Thanks Ahead of Time


Ken Snell said:
What is OutDate? A field in the form's recordset? A control on the form?
What type of control?

The error that you see indicates that either OutDate is not a control on the
form, or that OutDate is a control that does not have a SetFocus method
(such as a label).

--

Ken Snell
<MS ACCESS MVP>

Ronnie said:
I have the following code and I have tried everything. Can anyone tell me
why I get this error ont the OutDate field
"Method or Data member not found!"

This is the code...
Private Sub Form_Load()
Me.SoftwareID = Forms![frm-Software Media Library].[SoftwareID]
Me.Command33.Visible = False
Me.OutDate.SetFocus
'Forms!frm-SoftwareCheckoutHistory!OutDate.SetFocus
'frm-SoftwareCheckoutHistory!OutDate.SetFocus
End Sub
 
OutDate is a field that was draged from the field list to the form.
I believe it makes it a control is that a correct.

1) Try:
Me![OutDate].SetFocus

2) What happens if you simply set the [OutDate] control's Tab Order
position to #1?
It would then automatically go to that control when the form opens. In
which case you do not need to use that SetFocus line at all.
 
This OutDate control isn't by any chance on a subform and your code runs in
the main form, or vice-versa?
--

Ken Snell
<MS ACCESS MVP>

Ronnie said:
OutDate is a field that was draged from the field list to the form. I
believe it makes it a control is that a correct.
--
Sincere Thanks Ahead of Time


Ken Snell said:
What is OutDate? A field in the form's recordset? A control on the form?
What type of control?

The error that you see indicates that either OutDate is not a control on the
form, or that OutDate is a control that does not have a SetFocus method
(such as a label).

--

Ken Snell
<MS ACCESS MVP>

Ronnie said:
I have the following code and I have tried everything. Can anyone
tell me
why I get this error ont the OutDate field
"Method or Data member not found!"

This is the code...
Private Sub Form_Load()
Me.SoftwareID = Forms![frm-Software Media Library].[SoftwareID]
Me.Command33.Visible = False
Me.OutDate.SetFocus
'Forms!frm-SoftwareCheckoutHistory!OutDate.SetFocus
'frm-SoftwareCheckoutHistory!OutDate.SetFocus
End Sub
 
No OutDate is on the main form and I am putting the code in on the onload event
--
Sincere Thanks Ahead of Time


Ken Snell said:
This OutDate control isn't by any chance on a subform and your code runs in
the main form, or vice-versa?
--

Ken Snell
<MS ACCESS MVP>

Ronnie said:
OutDate is a field that was draged from the field list to the form. I
believe it makes it a control is that a correct.
--
Sincere Thanks Ahead of Time


Ken Snell said:
What is OutDate? A field in the form's recordset? A control on the form?
What type of control?

The error that you see indicates that either OutDate is not a control on the
form, or that OutDate is a control that does not have a SetFocus method
(such as a label).

--

Ken Snell
<MS ACCESS MVP>

I have the following code and I have tried everything. Can anyone tell me
why I get this error ont the OutDate field

"Method or Data member not found!"

This is the code...
Private Sub Form_Load()
Me.SoftwareID = Forms![frm-Software Media Library].[SoftwareID]
Me.Command33.Visible = False
Me.OutDate.SetFocus
'Forms!frm-SoftwareCheckoutHistory!OutDate.SetFocus
'frm-SoftwareCheckoutHistory!OutDate.SetFocus
End Sub
 
If you can zip up the database with that form in it (strip out unnecessary
objects) and email to me, I'll take a look.

Remove "this is not real" from my reply email address.

--

Ken Snell
<MS ACCESS MVP>

Ronnie said:
No OutDate is on the main form and I am putting the code in on the onload event
--
Sincere Thanks Ahead of Time


Ken Snell said:
This OutDate control isn't by any chance on a subform and your code runs in
the main form, or vice-versa?
--

Ken Snell
<MS ACCESS MVP>

Ronnie said:
OutDate is a field that was draged from the field list to the form. I
believe it makes it a control is that a correct.
--
Sincere Thanks Ahead of Time


:

What is OutDate? A field in the form's recordset? A control on the form?
What type of control?

The error that you see indicates that either OutDate is not a
control on
the
form, or that OutDate is a control that does not have a SetFocus method
(such as a label).

--

Ken Snell
<MS ACCESS MVP>

I have the following code and I have tried everything. Can anyone tell me
why I get this error ont the OutDate field

"Method or Data member not found!"

This is the code...
Private Sub Form_Load()
Me.SoftwareID = Forms![frm-Software Media Library].[SoftwareID]
Me.Command33.Visible = False
Me.OutDate.SetFocus
'Forms!frm-SoftwareCheckoutHistory!OutDate.SetFocus
'frm-SoftwareCheckoutHistory!OutDate.SetFocus
End Sub
 
I don't know what the IsNothing function is, so unless you've written it and
it's in your code.....

I would use code similar to this for the AfterUpdate events of the controls:

Private Sub cmbx_Purpose_AfterUpdate()
Me.SavePrintClose.Visible = ((Len(Me.cmbx_Purpose.Value & "") > 0) + _
(Len(Me.cmbx_Requester.Value & "") > 0))
End Sub


Do not use the BeforeUpdate event at all.

--

Ken Snell
<MS ACCESS MVP>


Ronnie said:
Hi Ken, I was not able to get this to work but I figured out another way.
I am now having problems with Visibility on a button can you take a look at
this code and let me know what you think? The code is below. I would be
glad to send you the database if needed if you can provide an email address.
Thanks in advance.
CodeBeginsHere----------
I don't want the button SavePrintClose to be visible until something has
been selected from the drop down fields of Requester and Purpose have been
selected. Can anyone tell me why this code is not working. If either of
the 2 fields have been selected then the button is visible.
BEGINNING OF CODE
Option Compare Database
Option Explicit

Private Sub cmbx_Purpose_AfterUpdate()
Me.SavePrintClose.Visible = Not IsNull(Me.Purpose)
If IsNothing(Me.Requester) And (Me.Purpose) = 0 Then
'Me.SavePrintClose.Visible = Not IsNull(Me.Requester)
Me.SavePrintClose.Visible = False
Else
Me.SavePrintClose.Visible = True
End If

End Sub

Private Sub cmbx_Purpose_BeforeUpdate(Cancel As Integer)
If IsNothing(Me.Requester) And (Me.Purpose) = 0 Then
Me.SavePrintClose.Visible = False
Else
Me.SavePrintClose.Visible = True
End If
End Sub

Private Sub cmbx_Purpose_Exit(Cancel As Integer)
Me.CheckOutDateTime.SetFocus
End Sub
Private Sub cmbx_Requester_AfterUpdate()
If IsNothing(Me.Requester) And (Me.Purpose) = 0 Then
Me.SavePrintClose.Visible = False
Else
Me.SavePrintClose.Visible = True
End If

End Sub

Private Sub cmbx_Requester_BeforeUpdate(Cancel As Integer)
If IsNothing(Me.Requester) And (Me.Purpose) = 0 Then
Me.SavePrintClose.Visible = False
Else
Me.SavePrintClose.Visible = True
End If
End Sub

Private Sub Form_Current()
Me.SavePrintClose.Visible = Not IsNull(Me.Requester)
Me.SavePrintClose.Visible = Not IsNull(Me.Purpose)
End Sub
Private Sub Form_Load()
Me.SoftwareID = Forms![frm-Software Media Library].[SoftwareID]
Me.SavePrintClose.Visible = False ' We don't want to se the print
button until all data is filled in
Me.CheckOutDateTime.SetFocus ' This really is not needed because we
disabled Name so focus is already here
End Sub

Private Sub ExitForm_Click()
' User wants to bail
' If an edit in progress..
If (Me.Dirty = True) Then
' Clear it
Me.Undo
End If
' And close me
DoCmd.Close acForm, Me.Name
End Sub
Private Sub SavePrintClose_Click()
On Error GoTo Err_SavePrintClose_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
Exit_SavePrintClose_Click:
Exit Sub
Err_SavePrintClose_Click:
MsgBox Err.Description
Resume Exit_SavePrintClose_Click
End Sub
END OF CODE
CodeEndsHere-------

--
Sincere Thanks Ahead of Time


Ken Snell said:
If you can zip up the database with that form in it (strip out unnecessary
objects) and email to me, I'll take a look.

Remove "this is not real" from my reply email address.

--

Ken Snell
<MS ACCESS MVP>

Ronnie said:
No OutDate is on the main form and I am putting the code in on the
onload
event
--
Sincere Thanks Ahead of Time


:

This OutDate control isn't by any chance on a subform and your code
runs
in
the main form, or vice-versa?
--

Ken Snell
<MS ACCESS MVP>

OutDate is a field that was draged from the field list to the form. I
believe it makes it a control is that a correct.
--
Sincere Thanks Ahead of Time


:

What is OutDate? A field in the form's recordset? A control on
the
form?
What type of control?

The error that you see indicates that either OutDate is not a control on
the
form, or that OutDate is a control that does not have a SetFocus method
(such as a label).

--

Ken Snell
<MS ACCESS MVP>

I have the following code and I have tried everything. Can anyone
tell me
why I get this error ont the OutDate field

"Method or Data member not found!"

This is the code...
Private Sub Form_Load()
Me.SoftwareID = Forms![frm-Software Media Library].[SoftwareID]
Me.Command33.Visible = False
Me.OutDate.SetFocus
'Forms!frm-SoftwareCheckoutHistory!OutDate.SetFocus
'frm-SoftwareCheckoutHistory!OutDate.SetFocus
End Sub
 
Back
Top