Enter Parameter Value Problem

J

J. B.

Hey all,

I am trying to pass the value of a bounded combo box on one form to an
unbounded combo box on another form. I keep receiving Enter Parameter Value
Customers when I try to execute the code. Here is the code:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmContactList"

stLinkCriteria = "[Customers]=" & Me![CustID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Even if I enter a number of a Customer the frmContactList still opens blank.
Any help would be much appreciated.

Thanks in advance,

JB
 
V

Van T. Dinh

The code you post only open ther frmContactList and filter
its RecordSource to those Records that has [Customers] =
{a numeric value from CustID of your current Form). It
does *not* assign any value to the unbound ComboBox on
frmContactList as per your description.

1. Is [Customers] a *numeric* Field? Is it included in
the RecordSource of the Form frmContactList?

You need Yes to both questions for your filter to work.

2. You can get the [Enter Parameter Value] dialog if any
Field name is not recognized in the RecordSource of the
Form or the RowSources of the ComboBoxes / ListBoxes on
the Form. Also your ComboBox may be based on a
parametrised Query and if Access cannot resolve the
Parameter(s), it will ask you for the value(s).

HTH
Van T. Dinh
MVP (Access)
 
J

J. B.

Thank you for your post.

To answer the first question; [Customers] is a numeric field and is included
in the RecordSource of the Form frmContactList. The [Customers] combo box
is nothing more than combo box built on a table query involving two fields,
the Name and CustID in that sequence. Actually the only difference between
the [Customers] query and the query coming from the combo box on the Form
frmDataEntryCall is that the [Customers] query is has an ORDER BY
tblCustomer.Name clause sorting the Names of the customers.

For the second question, I have even added the column value on the Me!CustID
value in hopes to be more specific. I was wondering if there was a
different approach to solving this problem.

Thanks for you help. It is much appreciated.

Van T. Dinh said:
The code you post only open ther frmContactList and filter
its RecordSource to those Records that has [Customers] =
{a numeric value from CustID of your current Form). It
does *not* assign any value to the unbound ComboBox on
frmContactList as per your description.

1. Is [Customers] a *numeric* Field? Is it included in
the RecordSource of the Form frmContactList?

You need Yes to both questions for your filter to work.

2. You can get the [Enter Parameter Value] dialog if any
Field name is not recognized in the RecordSource of the
Form or the RowSources of the ComboBoxes / ListBoxes on
the Form. Also your ComboBox may be based on a
parametrised Query and if Access cannot resolve the
Parameter(s), it will ask you for the value(s).

HTH
Van T. Dinh
MVP (Access)


-----Original Message-----
Hey all,

I am trying to pass the value of a bounded combo box on one form to an
unbounded combo box on another form. I keep receiving Enter Parameter Value
Customers when I try to execute the code. Here is the code:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmContactList"

stLinkCriteria = "[Customers]=" & Me![CustID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Even if I enter a number of a Customer the frmContactList still opens blank.
Any help would be much appreciated.

Thanks in advance,

JB


.
 
V

Van T. Dinh

1. Like I wrote in my previous post, you have not assigned any value to the
unbound ComboBox with the code you posted!

If you want to do so, add code like:

stLinkCriteria = "[Customers]=" & Me![CustID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoEvents
Forms(strDocName)!UnboundComboBox = Me![CustID]

2. Note that because you use the strLinkCriteria (WhereCondition argument),
the frmContactList is likely to have only 1 Record in its (filtered)
RecordSource.

3. I am not even sure what you were trying to do from the second paragraph
of your post.
 

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