Open form a specific record - Newbie

D

Darryl

Hello Newgroup:

In my app, the user may select a record from a "listbox" by double-clicking.
I would like to open and display the selected record on a new form.

When I use the "DoCmd.Open"

PolicyNumb = 4

DoCmd.OpenForm "sfrmCnfrmEntryPolicies", , , Forms![frmItemList]![Policy_id]
= PolicyNumb

Ms-Access 2000, prompts me for the value of "PolicyNumb", even though that
var has been set in the code.

Is this the best way to approach this problem ? Any suggestions or
recommendations are greatly appreciated.

Thank you in advance.
 
S

Sandra Daigle

Hi Darryl,

The Where Condition parameter uses a string that tells Jet (the database
engine) which field to check, what comparison to use and the test value. Try
the following:

DoCmd.OpenForm "sfrmCnfrmEntryPolicies", , ,"[Policy_id]=" & PolicyNumb

In the above, "[Policy_ID]" should be inside the quotes and should be
replaced with the name of the field you want to test.
 
D

Darryl

This is working great Sandra! Thanks very much for answering my post.

Sandra Daigle said:
Hi Darryl,

The Where Condition parameter uses a string that tells Jet (the database
engine) which field to check, what comparison to use and the test value. Try
the following:

DoCmd.OpenForm "sfrmCnfrmEntryPolicies", , ,"[Policy_id]=" & PolicyNumb

In the above, "[Policy_ID]" should be inside the quotes and should be
replaced with the name of the field you want to test.

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

Hello Newgroup:

In my app, the user may select a record from a "listbox" by
double-clicking. I would like to open and display the selected record
on a new form.

When I use the "DoCmd.Open"

PolicyNumb = 4

DoCmd.OpenForm "sfrmCnfrmEntryPolicies", , ,
Forms![frmItemList]![Policy_id] = PolicyNumb

Ms-Access 2000, prompts me for the value of "PolicyNumb", even though
that var has been set in the code.

Is this the best way to approach this problem ? Any suggestions or
recommendations are greatly appreciated.

Thank you in advance.
 

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