Hi
Quite likely the illegal name for the form name, since it contains
spaces.
In such case, you have to surround it with [ ]:
DoCmd.OpenForm "Study details1",
WhereCondition:="StudyRefNo=FORMS![Start up form]!Combo25"
be sure the [ ] does NOT include any of the bangs (!).
Hoping it may help
Vanderghast, Access MVP
message
Michel,
I'm still having trouble and hope you don't get fed up with me as I'd
really
like to get this control to work as it will be so useful for future
databases
too which I do.
I put:
Private Sub Combo25_AfterUpdate()
DoCmd.OpenForm "Study details1",
WhereCondition:="StudyRefNo=FORMS!Start up form!Combo25"
End Sub
However, I keep getting errors in yellow and red highlights and the :=
becomes highlighted too. Can you spot where I could be going wrong?
Kind regards,
Liz.
:
Hi,
Your combo box has two columns? then in the AfterUpdate event
(subroutine
handler) of the combo box, should be:
DoCmd.OpenForm "FormNameToOpen",
WhereCondition:="PrimaryKeyFieldNameHere=FORMS!ActualFormNameHere!ActualComboBoxControlNameHere"
should do. FormNameToOpen, PrimaryKeyFieldNameHere and
ActualFormNameHere
and also ActualComboBoxControlNameHere has to be replaced with the
actual
name you use. Note there is a : in front of the = right after
WhereCondition (to be written as it is). That syntax allows to skip
over
some optional parameters, making the line a shorter statement (and
less
confusing than counting the right number of coma ) .
I suggest John L. Viescas book, "Microsoft Access 2003 Inside Out", as
example, if you look for a book targeting the basic user interface.
Hoping it may help,
Vanderghast, Access MVP
message
Hi Michel,
Thanks very much for you reply. I am however, a bit stuck as I don't
quite
know where to start. Should I create a form with the combo box first
which
would hold the primary key 'studyno' and the title of the study
'studyname'.
When I click on the studyno I want it to take me to the form where I
enter
the details of the study 'study details' and for that specific
record
to
be
shown (that I'd just selected).
I'm not sure what or where to put the coding that you have given to
me -
sorry about this. Would it be possible for you give me a step by
step
guide
as to where to go and what to click, so I can incorporate the coding
to
achieve the above. This would be such a great help to me and I'd be
really
pleased.
Kind regards,
Liz.
:
Hi,
The DoCmd.OpenForm procedure allow a parameter, whereCondition, to
specify,
as a string, a condition that limit the records to be displayed. If
you
have
a primarykey, you can use, as example:
"primaryKey=" & wantedPrimaryKey
for this argument, in the DoCmd.OpenForm. I assumed the field name
is
primaryKey and your variable wantedPrimaryKey contains the
numerical
value
for the desired primary key.
Hoping it may help,
Vanderghast, Access MVP
message
Hi,
I am still working on an Access database which holds records of
clinical
trials studies. Each study has its own study number and title.
When
the
database starts up, the switchboard form appears first. I would
like
on
here,
to be able to select from a drop down list the a certain record
and
after
clicking the title, study number or both, the form where I enter
details
for
these records/studies will view the record just selected from the
list
box/drop down list I want on my switch board form. Can anyone
describe
a
non-complicated or step by step guide on how I could create this,
as
I
do
most of my form features e.g command buttons, using the wizard
toolbar.
I'd
be most grateful.
Many thanks,
Liz.