Works in WinXP, not in Vista

E

eschloss

Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the AfterUpdate
event for a combobox control on my Subform. The last parameter in this event
code is where Vista throws up the following error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value = Me!Current_Name_Text
End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes text box
with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]") =
Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]") =
Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]") =
Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]") =
Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]") =
Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]") =
Me.Parent!Year_Combo
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]") = Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************
 
J

Jeanette Cunningham

Hi eschloss,
to refer to a control on a subform, use syntax like this when you are
clicking a control on the main form-->
Me.NameOfSubformControl.Form.NameOfControl

The snippet you posted-->
("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
has too many parts to it.

If the subform is on the main form and the code is run by clicking a control
on the main form, you can just use Me
instead of [Forms]![frmMain]


Note: the subform control is on the main form and the subform is inside the
subform control.
To get the name of the subform control, click once on the subform control -
you will be able to see the handles around the subform control.

Replace the obvious with your control names.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


eschloss said:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate
event for a combobox control on my Subform. The last parameter in this
event
code is where Vista throws up the following error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value = Me!Current_Name_Text
End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes text box
with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]") =
Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]") =
Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]") =
Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]") =
Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]") =
Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]") =
Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************
 
R

RoyVidar

eschloss said:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate event for a combobox control on my Subform. The last
parameter in this event code is where Vista throws up the following
error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me!Current_Name_Text End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes text
box with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]")
= Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]")
= Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]")
= Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]")
= Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]")
= Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]")
= Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************

The reference looks correct, though I'm inclined to use dot's only for
properties

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

This would also be be the syntax you'd get if you enter the expression
builder in the criteria part of the query grid, doubleclick through
forms, loaded forms, main form, first subform, second subform and a
control on that second subform AND the same syntax you'll find for
instance at the bottom of http://www.mvps.org/access/forms/frm0031.htm

I'd try using that format/syntax both in the stored query and when
setting the parameter in code AND also add/define it as parameter in
the stored query (I thin you'll find the parameters dialogue on the
query meny, at the bottom?) - copy/paste the whole reference there
too, and specify data type.

As a test, I think I'd try testing whether it's got a value at that
point, for instance with a msgbox or debug.print

Debug.Print
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

and check in the immediate pane (ctrl+g)
 
E

eschloss

Sorry for the delayed response...I can only test this when I get off work on
my home Vista machine.

Thank you two for responding. I receive the same error in the same place
after I:

1. Changed the error line to
qdf.Parameters("[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]") = Me!QC_Names_Combo

2. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo] into the appropriate field criteria of my stored query.

3. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the parameter section of my stored query and attached a Data Type of
"Text" to it.

4. Adding Debug.Print above the error line did not make it return a value in
the immediate window. However, while stepping through the code, when I hover
the mouse over "= Me!QC_Names_Combo", the correct value shows up.

Do any other possibilities come to mind?

RoyVidar said:
eschloss said:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate event for a combobox control on my Subform. The last
parameter in this event code is where Vista throws up the following
error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me!Current_Name_Text End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes text
box with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]")
= Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]")
= Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]")
= Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]")
= Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]")
= Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]")
= Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************

The reference looks correct, though I'm inclined to use dot's only for
properties

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

This would also be be the syntax you'd get if you enter the expression
builder in the criteria part of the query grid, doubleclick through
forms, loaded forms, main form, first subform, second subform and a
control on that second subform AND the same syntax you'll find for
instance at the bottom of http://www.mvps.org/access/forms/frm0031.htm

I'd try using that format/syntax both in the stored query and when
setting the parameter in code AND also add/define it as parameter in
the stored query (I thin you'll find the parameters dialogue on the
query meny, at the bottom?) - copy/paste the whole reference there
too, and specify data type.

As a test, I think I'd try testing whether it's got a value at that
point, for instance with a msgbox or debug.print

Debug.Print
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

and check in the immediate pane (ctrl+g)
 
J

Jeanette Cunningham

Have a look this link about problems with parameters in queries
http://allenbrowne.com/bug-13.html

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


eschloss said:
Sorry for the delayed response...I can only test this when I get off work
on
my home Vista machine.

Thank you two for responding. I receive the same error in the same place
after I:

1. Changed the error line to
qdf.Parameters("[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]")
= Me!QC_Names_Combo

2. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the appropriate field criteria of my stored query.

3. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the parameter section of my stored query and attached a Data Type of
"Text" to it.

4. Adding Debug.Print above the error line did not make it return a value
in
the immediate window. However, while stepping through the code, when I
hover
the mouse over "= Me!QC_Names_Combo", the correct value shows up.

Do any other possibilities come to mind?

RoyVidar said:
eschloss said:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate event for a combobox control on my Subform. The last
parameter in this event code is where Vista throws up the following
error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me!Current_Name_Text End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes text
box with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]")
= Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]")
= Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]")
= Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]")
= Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]")
= Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]")
= Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************

The reference looks correct, though I'm inclined to use dot's only for
properties

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

This would also be be the syntax you'd get if you enter the expression
builder in the criteria part of the query grid, doubleclick through
forms, loaded forms, main form, first subform, second subform and a
control on that second subform AND the same syntax you'll find for
instance at the bottom of http://www.mvps.org/access/forms/frm0031.htm

I'd try using that format/syntax both in the stored query and when
setting the parameter in code AND also add/define it as parameter in
the stored query (I thin you'll find the parameters dialogue on the
query meny, at the bottom?) - copy/paste the whole reference there
too, and specify data type.

As a test, I think I'd try testing whether it's got a value at that
point, for instance with a msgbox or debug.print

Debug.Print
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

and check in the immediate pane (ctrl+g)
 
E

eschloss

Jeanette,

I thought it may have been this too when I was researching my problem. I
have tried changing data types but I still get the same error on the same
code line.

btw, the combobox value the code line error refers to should always have a
value in it, when I receive the error it does have a value. Also, this code
works as expected in WinXP, but not in Vista.

Jeanette Cunningham said:
Have a look this link about problems with parameters in queries
http://allenbrowne.com/bug-13.html

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


eschloss said:
Sorry for the delayed response...I can only test this when I get off work
on
my home Vista machine.

Thank you two for responding. I receive the same error in the same place
after I:

1. Changed the error line to
qdf.Parameters("[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]")
= Me!QC_Names_Combo

2. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the appropriate field criteria of my stored query.

3. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the parameter section of my stored query and attached a Data Type of
"Text" to it.

4. Adding Debug.Print above the error line did not make it return a value
in
the immediate window. However, while stepping through the code, when I
hover
the mouse over "= Me!QC_Names_Combo", the correct value shows up.

Do any other possibilities come to mind?

RoyVidar said:
eschloss wrote:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate event for a combobox control on my Subform. The last
parameter in this event code is where Vista throws up the following
error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me!Current_Name_Text End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes text
box with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]")
= Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]")
= Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]")
= Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]")
= Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]")
= Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]")
= Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************

The reference looks correct, though I'm inclined to use dot's only for
properties

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

This would also be be the syntax you'd get if you enter the expression
builder in the criteria part of the query grid, doubleclick through
forms, loaded forms, main form, first subform, second subform and a
control on that second subform AND the same syntax you'll find for
instance at the bottom of http://www.mvps.org/access/forms/frm0031.htm

I'd try using that format/syntax both in the stored query and when
setting the parameter in code AND also add/define it as parameter in
the stored query (I thin you'll find the parameters dialogue on the
query meny, at the bottom?) - copy/paste the whole reference there
too, and specify data type.

As a test, I think I'd try testing whether it's got a value at that
point, for instance with a msgbox or debug.print

Debug.Print
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

and check in the immediate pane (ctrl+g)
 
R

RoyVidar

eschloss said:
Sorry for the delayed response...I can only test this when I get off
work on my home Vista machine.

Thank you two for responding. I receive the same error in the same
place after I:

1. Changed the error line to
qdf.Parameters("[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]")
= Me!QC_Names_Combo

2. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the appropriate field criteria of my stored query.

3. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the parameter section of my stored query and attached a Data
Type of "Text" to it.

4. Adding Debug.Print above the error line did not make it return a
value in the immediate window. However, while stepping through the
code, when I hover the mouse over "= Me!QC_Names_Combo", the correct
value shows up.

Do any other possibilities come to mind?

RoyVidar said:
eschloss said:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate event for a combobox control on my Subform. The last
parameter in this event code is where Vista throws up the
following error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me!Current_Name_Text End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes
text box with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]")
= Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]")
= Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]")
= Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]")
= Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]")
= Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]")
= Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************

The reference looks correct, though I'm inclined to use dot's only
for properties

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

This would also be be the syntax you'd get if you enter the
expression builder in the criteria part of the query grid,
doubleclick through forms, loaded forms, main form, first subform,
second subform and a control on that second subform AND the same
syntax you'll find for instance at the bottom of
http://www.mvps.org/access/forms/frm0031.htm

I'd try using that format/syntax both in the stored query and when
setting the parameter in code AND also add/define it as parameter in
the stored query (I thin you'll find the parameters dialogue on the
query meny, at the bottom?) - copy/paste the whole reference there
too, and specify data type.

As a test, I think I'd try testing whether it's got a value at that
point, for instance with a msgbox or debug.print

Debug.Print
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

and check in the immediate pane (ctrl+g)

Re #4 - seems the control has a value when referenced through current
form, but not if referenced through the full path - strange.

Could it be some timing issues? You could also try removing the last
Form keyword, and see if that works (optional when referring to
controls, necessary when referring to properties), and since it is
text, remove the parameter declaration

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform]![QC_Names_Combo]

But I don't know.

If the reference is correct, you could also try to resovle the
paremeters dynamic in stead of your more explicit resolving, i e

dim prm as dao.parameter
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
for each prm in qdf.Parameters
prm.value = eval(prm.name)
next prm

but I don't know whether it would matter. Sorry, I'm stumped.
 
J

Jeanette Cunningham

Going back to your first post on this.
Looking at your code, I see a line that shouldn't compile -- >

*Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate*

What happens when you do debug compile?


Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value = Me!Current_Name_Text
End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

eschloss said:
Jeanette,

I thought it may have been this too when I was researching my problem. I
have tried changing data types but I still get the same error on the same
code line.

btw, the combobox value the code line error refers to should always have a
value in it, when I receive the error it does have a value. Also, this
code
works as expected in WinXP, but not in Vista.

Jeanette Cunningham said:
Have a look this link about problems with parameters in queries
http://allenbrowne.com/bug-13.html

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


eschloss said:
Sorry for the delayed response...I can only test this when I get off
work
on
my home Vista machine.

Thank you two for responding. I receive the same error in the same
place
after I:

1. Changed the error line to
qdf.Parameters("[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]")
= Me!QC_Names_Combo

2. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the appropriate field criteria of my stored query.

3. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the parameter section of my stored query and attached a Data Type
of
"Text" to it.

4. Adding Debug.Print above the error line did not make it return a
value
in
the immediate window. However, while stepping through the code, when I
hover
the mouse over "= Me!QC_Names_Combo", the correct value shows up.

Do any other possibilities come to mind?

:

eschloss wrote:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate event for a combobox control on my Subform. The last
parameter in this event code is where Vista throws up the following
error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me!Current_Name_Text End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes
text
box with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]")
= Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]")
= Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]")
= Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]")
= Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]")
= Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]")
= Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************

The reference looks correct, though I'm inclined to use dot's only for
properties

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

This would also be be the syntax you'd get if you enter the expression
builder in the criteria part of the query grid, doubleclick through
forms, loaded forms, main form, first subform, second subform and a
control on that second subform AND the same syntax you'll find for
instance at the bottom of http://www.mvps.org/access/forms/frm0031.htm

I'd try using that format/syntax both in the stored query and when
setting the parameter in code AND also add/define it as parameter in
the stored query (I thin you'll find the parameters dialogue on the
query meny, at the bottom?) - copy/paste the whole reference there
too, and specify data type.

As a test, I think I'd try testing whether it's got a value at that
point, for instance with a msgbox or debug.print

Debug.Print
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

and check in the immediate pane (ctrl+g)
 
E

eschloss

THE VISTA GODS ARE APPEASED!!! Thank you! Resolving the parameters the way
you suggested is what did it. Is there any downfall to resolving all my
parameters this way instead (in other forms, etc)?

RoyVidar said:
eschloss said:
Sorry for the delayed response...I can only test this when I get off
work on my home Vista machine.

Thank you two for responding. I receive the same error in the same
place after I:

1. Changed the error line to
qdf.Parameters("[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]")
= Me!QC_Names_Combo

2. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the appropriate field criteria of my stored query.

3. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the parameter section of my stored query and attached a Data
Type of "Text" to it.

4. Adding Debug.Print above the error line did not make it return a
value in the immediate window. However, while stepping through the
code, when I hover the mouse over "= Me!QC_Names_Combo", the correct
value shows up.

Do any other possibilities come to mind?

RoyVidar said:
eschloss wrote:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate event for a combobox control on my Subform. The last
parameter in this event code is where Vista throws up the
following error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me!Current_Name_Text End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes
text box with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]")
= Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]")
= Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]")
= Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]")
= Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]")
= Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]")
= Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************

The reference looks correct, though I'm inclined to use dot's only
for properties

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

This would also be be the syntax you'd get if you enter the
expression builder in the criteria part of the query grid,
doubleclick through forms, loaded forms, main form, first subform,
second subform and a control on that second subform AND the same
syntax you'll find for instance at the bottom of
http://www.mvps.org/access/forms/frm0031.htm

I'd try using that format/syntax both in the stored query and when
setting the parameter in code AND also add/define it as parameter in
the stored query (I thin you'll find the parameters dialogue on the
query meny, at the bottom?) - copy/paste the whole reference there
too, and specify data type.

As a test, I think I'd try testing whether it's got a value at that
point, for instance with a msgbox or debug.print

Debug.Print
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

and check in the immediate pane (ctrl+g)

Re #4 - seems the control has a value when referenced through current
form, but not if referenced through the full path - strange.

Could it be some timing issues? You could also try removing the last
Form keyword, and see if that works (optional when referring to
controls, necessary when referring to properties), and since it is
text, remove the parameter declaration

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform]![QC_Names_Combo]

But I don't know.

If the reference is correct, you could also try to resovle the
paremeters dynamic in stead of your more explicit resolving, i e

dim prm as dao.parameter
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
for each prm in qdf.Parameters
prm.value = eval(prm.name)
next prm

but I don't know whether it would matter. Sorry, I'm stumped.
 
J

Jeanette Cunningham

Another thought
what happens when you put -->

Debug.Print Me!QC_Names_Combo

here

Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes text box
with current combobox name

Debug.Print Me!QC_Names_Combo

What happens if there is no value for QC_Names_Combo?

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Jeanette Cunningham said:
Going back to your first post on this.
Looking at your code, I see a line that shouldn't compile -- >

*Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate*

What happens when you do debug compile?


Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value = Me!Current_Name_Text
End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

eschloss said:
Jeanette,

I thought it may have been this too when I was researching my problem. I
have tried changing data types but I still get the same error on the same
code line.

btw, the combobox value the code line error refers to should always have
a
value in it, when I receive the error it does have a value. Also, this
code
works as expected in WinXP, but not in Vista.

Jeanette Cunningham said:
Have a look this link about problems with parameters in queries
http://allenbrowne.com/bug-13.html

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Sorry for the delayed response...I can only test this when I get off
work
on
my home Vista machine.

Thank you two for responding. I receive the same error in the same
place
after I:

1. Changed the error line to
qdf.Parameters("[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]")
= Me!QC_Names_Combo

2. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the appropriate field criteria of my stored query.

3. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the parameter section of my stored query and attached a Data Type
of
"Text" to it.

4. Adding Debug.Print above the error line did not make it return a
value
in
the immediate window. However, while stepping through the code, when
I
hover
the mouse over "= Me!QC_Names_Combo", the correct value shows up.

Do any other possibilities come to mind?

:

eschloss wrote:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate event for a combobox control on my Subform. The last
parameter in this event code is where Vista throws up the
following
error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me!Current_Name_Text End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes
text
box with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]")
= Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]")
= Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]")
= Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]")
= Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]")
= Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]")
= Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************

The reference looks correct, though I'm inclined to use dot's only
for
properties

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

This would also be be the syntax you'd get if you enter the
expression
builder in the criteria part of the query grid, doubleclick through
forms, loaded forms, main form, first subform, second subform and a
control on that second subform AND the same syntax you'll find for
instance at the bottom of
http://www.mvps.org/access/forms/frm0031.htm

I'd try using that format/syntax both in the stored query and when
setting the parameter in code AND also add/define it as parameter in
the stored query (I thin you'll find the parameters dialogue on the
query meny, at the bottom?) - copy/paste the whole reference there
too, and specify data type.

As a test, I think I'd try testing whether it's got a value at that
point, for instance with a msgbox or debug.print

Debug.Print
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

and check in the immediate pane (ctrl+g)
 
A

AccessVandal via AccessMonster.com

Your problem of control's value is no unique to me. I have the same problem
as you had discribed. Seems to be a Vista problem.
 
E

eschloss

Jeanette,

That line compiles without issues. When I step through the code, that line
directs me correctly to the AfterUpdate event and continues. I do not
remember where I picked up that method of calling events. I noticed it in
someone's response while researching another problem I had.

Jeanette Cunningham said:
Going back to your first post on this.
Looking at your code, I see a line that shouldn't compile -- >

*Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate*

What happens when you do debug compile?


Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value = Me!Current_Name_Text
End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

eschloss said:
Jeanette,

I thought it may have been this too when I was researching my problem. I
have tried changing data types but I still get the same error on the same
code line.

btw, the combobox value the code line error refers to should always have a
value in it, when I receive the error it does have a value. Also, this
code
works as expected in WinXP, but not in Vista.

Jeanette Cunningham said:
Have a look this link about problems with parameters in queries
http://allenbrowne.com/bug-13.html

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Sorry for the delayed response...I can only test this when I get off
work
on
my home Vista machine.

Thank you two for responding. I receive the same error in the same
place
after I:

1. Changed the error line to
qdf.Parameters("[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]")
= Me!QC_Names_Combo

2. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the appropriate field criteria of my stored query.

3. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the parameter section of my stored query and attached a Data Type
of
"Text" to it.

4. Adding Debug.Print above the error line did not make it return a
value
in
the immediate window. However, while stepping through the code, when I
hover
the mouse over "= Me!QC_Names_Combo", the correct value shows up.

Do any other possibilities come to mind?

:

eschloss wrote:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate event for a combobox control on my Subform. The last
parameter in this event code is where Vista throws up the following
error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me!Current_Name_Text End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes
text
box with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]")
= Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]")
= Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]")
= Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]")
= Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]")
= Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]")
= Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************

The reference looks correct, though I'm inclined to use dot's only for
properties

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

This would also be be the syntax you'd get if you enter the expression
builder in the criteria part of the query grid, doubleclick through
forms, loaded forms, main form, first subform, second subform and a
control on that second subform AND the same syntax you'll find for
instance at the bottom of http://www.mvps.org/access/forms/frm0031.htm

I'd try using that format/syntax both in the stored query and when
setting the parameter in code AND also add/define it as parameter in
the stored query (I thin you'll find the parameters dialogue on the
query meny, at the bottom?) - copy/paste the whole reference there
too, and specify data type.

As a test, I think I'd try testing whether it's got a value at that
point, for instance with a msgbox or debug.print

Debug.Print
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

and check in the immediate pane (ctrl+g)
 
E

eschloss

The code for Add_Edit_Label_Click() takes care of ensuring QC_Names_Combo
always has a value in it. I believe setting the sourceobject automatically
refreshes QC_Names_Combo, just not selecting any of its available values.
The rest of the code for Add_Edit_Label_Click() takes care of that.

The way I have the date range setup, is that only days which have records
associated to them are selectable. So, there should always be available
values in QC_Names_Combo because a Name is required for all my records.

Jeanette Cunningham said:
Another thought
what happens when you put -->

Debug.Print Me!QC_Names_Combo

here

Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes text box
with current combobox name

Debug.Print Me!QC_Names_Combo

What happens if there is no value for QC_Names_Combo?

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Jeanette Cunningham said:
Going back to your first post on this.
Looking at your code, I see a line that shouldn't compile -- >

*Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate*

What happens when you do debug compile?


Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value = Me!Current_Name_Text
End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

eschloss said:
Jeanette,

I thought it may have been this too when I was researching my problem. I
have tried changing data types but I still get the same error on the same
code line.

btw, the combobox value the code line error refers to should always have
a
value in it, when I receive the error it does have a value. Also, this
code
works as expected in WinXP, but not in Vista.

:

Have a look this link about problems with parameters in queries
http://allenbrowne.com/bug-13.html

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Sorry for the delayed response...I can only test this when I get off
work
on
my home Vista machine.

Thank you two for responding. I receive the same error in the same
place
after I:

1. Changed the error line to
qdf.Parameters("[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]")
= Me!QC_Names_Combo

2. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the appropriate field criteria of my stored query.

3. Copied/pasted
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]
into the parameter section of my stored query and attached a Data Type
of
"Text" to it.

4. Adding Debug.Print above the error line did not make it return a
value
in
the immediate window. However, while stepping through the code, when
I
hover
the mouse over "= Me!QC_Names_Combo", the correct value shows up.

Do any other possibilities come to mind?

:

eschloss wrote:
Work - 2003 SP? with WinXP
Home - 2003 SP3 with Vista

Parent Form - frmMain
Parent Form Subform container - Main_Subform
Form - frmSchedules
Form Subform container - Schedules_Subform
Subform - frmSchedules_Add/Edit

When I click the Add_Edit_Label on my Form, the code goes to the
AfterUpdate event for a combobox control on my Subform. The last
parameter in this event code is where Vista throws up the
following
error:

Run-time error '3000':
Reserved error (-1038); there is no message for this error.

Does anyone know what is happening here?

Code behind my Form:
**********************************************************
Private Sub Add_Edit_Label_Click()
Me!Schedules_Subform.SourceObject = "frmSchedules_Add/Edit"

If IsNull(Me!Current_Name_Text) Then
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me.Schedules_Subform.Form.QC_Names_Combo.ItemData(0)
Else
Me.Schedules_Subform.Form.QC_Names_Combo.Value =
Me!Current_Name_Text End If

Me.Schedules_Subform.Form.QC_Names_Combo_AfterUpdate
End Sub
**********************************************************

Code behind my Subform:
**********************************************************
Public Sub QC_Names_Combo_AfterUpdate()

Me.Parent!Current_Name_Text = Me!QC_Names_Combo.Value 'refreshes
text
box with current combobox name

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim monday_count As Integer
Dim tuesday_count As Integer
Dim wednesday_count As Integer
Dim thursday_count As Integer
Dim friday_count As Integer

monday_count = 0
tuesday_count = 0
wednesday_count = 0
thursday_count = 0
friday_count = 0

Set db = CurrentDb()

'Get information for selected QC names.
Set qdf = db.QueryDefs("qrySchedules_Add/Edit")
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo1]")
= Me.Parent!Month_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo1]")
= Me.Parent!Day_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo1]")
= Me.Parent!Year_Combo1
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Month_Combo2]")
= Me.Parent!Month_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Day_Combo2]")
= Me.Parent!Day_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Year_Combo2]")
= Me.Parent!Year_Combo2
qdf.Parameters("[Forms]![frmMain].[Main_Subform].[form].[Schedules_Subform].[form].[QC_Names_Combo]")
= Me!QC_Names_Combo '<-ERROR LINE

Set rst = qdf.OpenRecordset()
**********************************************************

The reference looks correct, though I'm inclined to use dot's only
for
properties

[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

This would also be be the syntax you'd get if you enter the
expression
builder in the criteria part of the query grid, doubleclick through
forms, loaded forms, main form, first subform, second subform and a
control on that second subform AND the same syntax you'll find for
instance at the bottom of
http://www.mvps.org/access/forms/frm0031.htm

I'd try using that format/syntax both in the stored query and when
setting the parameter in code AND also add/define it as parameter in
the stored query (I thin you'll find the parameters dialogue on the
query meny, at the bottom?) - copy/paste the whole reference there
too, and specify data type.

As a test, I think I'd try testing whether it's got a value at that
point, for instance with a msgbox or debug.print

Debug.Print
[Forms]![frmMain]![Main_Subform].[form]![Schedules_Subform].[form]![QC_Names_Combo]

and check in the immediate pane (ctrl+g)
 
R

RoyVidar

eschloss said:
THE VISTA GODS ARE APPEASED!!! Thank you! Resolving the parameters
the way you suggested is what did it. Is there any downfall to
resolving all my parameters this way instead (in other forms, etc)?

"RoyVidar" wrote:

No, now _downfall_ , but of course a _downside_ ;-)

Resolving parameters explicitly, like you did initially, should
normally be faster than dynamic resolving, but I don't know by how
much, you'd better test - and do so with a production size db (# of
records), but the method is fairly common among developers.

What frustrates me a bit here, is that I don't understand why it
works, and the explicit resolving doesn't, but I'm happy you got
it to work ;-)
 

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