Problem setting Property Sheet values for a Form using VBA

A

Atlas

Hello,

I have a problem with setting Property Sheet values for a Form using VBA
code. I am trying to set the following properties:

..RecordSource
..InputParameters
..UniqueTable

I am setting this in an ADP and for a couple of my users my code works
without any problem, and for other users it errors because it cannot set the
properties in the form.

My code which works:

With Me.sfrmppepCGL_1_HeadsOfCover.Form
.RecordSource = "dbo.procHeadsOfCoverByPolicyLineIDTypeGet"
.InputParameters = "@lngPolicyLineID int =" & Nz(Me.txtPolicyLineID,
0) & ", @lngPolicyLineTypeID int = " & gclngPL_CGL
.UniqueTable = "dbo.tblHeadsOfCover"
End With

The error message I get when using the above code is:

Run-time error 2101
The setting you entered isn't valid for this property

Incidently, if i set the parameters using a different method it actually
works (not using WITH / END WITH):

Me.sfrmppepCGL_1_HeadsOfCover.Form.RecordSource =
"procHeadsOfCoverByPolicyLineIDTypeGet"
Me.sfrmppepCGL_1_HeadsOfCover.Form.UniqueTable = "tblHeadsOfCover"
Me.sfrmppepCGL_1_HeadsOfCover.Form.InputParameters = "@lngPolicyLineID int
=" & Nz(Me.txtPolicyLineID, 0) & ", @lngPolicyLineTypeID int = " & gclngPL_CGL

I can't understand why this would be the case - is there any library
references that I should check that i have not referenced?

Suggestions and help is greatly appreciated as I just can't work this one out.

Thanks
 
B

Brendan Reynolds

Atlas said:
Hello,

I have a problem with setting Property Sheet values for a Form using VBA
code. I am trying to set the following properties:

.RecordSource
.InputParameters
.UniqueTable

I am setting this in an ADP and for a couple of my users my code works
without any problem, and for other users it errors because it cannot set
the
properties in the form.

My code which works:

With Me.sfrmppepCGL_1_HeadsOfCover.Form
.RecordSource = "dbo.procHeadsOfCoverByPolicyLineIDTypeGet"
.InputParameters = "@lngPolicyLineID int =" &
Nz(Me.txtPolicyLineID,
0) & ", @lngPolicyLineTypeID int = " & gclngPL_CGL
.UniqueTable = "dbo.tblHeadsOfCover"
End With

The error message I get when using the above code is:

Run-time error 2101
The setting you entered isn't valid for this property

Incidently, if i set the parameters using a different method it actually
works (not using WITH / END WITH):

Me.sfrmppepCGL_1_HeadsOfCover.Form.RecordSource =
"procHeadsOfCoverByPolicyLineIDTypeGet"
Me.sfrmppepCGL_1_HeadsOfCover.Form.UniqueTable = "tblHeadsOfCover"
Me.sfrmppepCGL_1_HeadsOfCover.Form.InputParameters = "@lngPolicyLineID int
=" & Nz(Me.txtPolicyLineID, 0) & ", @lngPolicyLineTypeID int = " &
gclngPL_CGL

I can't understand why this would be the case - is there any library
references that I should check that i have not referenced?

Suggestions and help is greatly appreciated as I just can't work this one
out.

Thanks


There are actually *two* differences between the code that exhibits the
problem and the code that does not. In addition to not using With ... End
With, the code that does not exhibit the problem does not use the "dbo."
prefix. I suspect that this is more likely to be the significant difference,
but it's been so long since I did anything with ADPs that I can't remember
the details of this issue. If no one else replies here, you might want to
try posting the question in the ADP group.
 

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

Top