I'm being thick-again

scary1

Registered User.
Local time
Today, 23:23
Joined
Feb 25, 2003
Messages
20
Been staring at this for ages-cant work out whats wrong with it, i have a headache and the "friday feeling" please help.

OK i have some patient records in a table and a data input form.
I want to display the list of names in a list box on another form so that when you click on a name it takes you to the correct data input form.

Here is my code:

Private Sub List0_Click()
DoCmd.OpenForm "Main Input Form", , , "[Pat ID] = " & CLng(Me.List0.Column(0)), acFormEdit
DoCmd.Close acForm, "test", acSaveYes
End Sub

Right when i click on a name in the list i get a parameter query box that says
Enter Parameter value then Pat ID

Anyone know what i have done wrong.

God i need a beer!
 
I tend to use the code below on the OnClick event of a button on a pick list form.

The user picks a value of the form, then clicks on an "OK" button and this opens the form on the matching value.

This way there's no need for parameter queries - you can just open the data entry form direct from the pick list form.

Hope this helps,

Rusty
:D

(I also need beer!!
food-smiley-005.gif
)

Code:
Private Sub cmdOK_Click()
DoCmd.OpenForm "formname", acNormal, , "[reference] like '" & Me![cboProjectRef] & "'", , acWindowNormal, ""

‘reference is the CONTROL SOURCE of the field on the form you are opening
‘cboProjectRef is the FIELD NAME of the field on the form you are opening from

'then close the pick list form here AFTER the data entry form has been opened
docmd.close acform...

End Sub
 
Have you tried with

DoCmd.OpenForm "Main Input Form", , , "[Pat ID] = '" & CLng(Me.List0.Column(0)) & "'", acFormEdit ??

Filippo
 
aaarrgh

Its driving me nuts. I have used this before and i cant figure out what is different,

I keep getting the annoying message box "enter parameter value" thing is i am basing the list on a table not a query-i just dont get it.
 
scary1 said:
Its driving me nuts. I have used this before and i cant figure out what is different...

Can you attach the database - or at least a copy that has the tables and forms in question? You can fill the table with a few dummy records to maintain patient confidentiality (I also work in the NHS).

Rusty
:D
 
Last edited:
you know i said i was thick well...heres proof

I have got it!

It wasnt Pat ID it was PatID


aaarrggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

going home now!
 

Users who are viewing this thread

Back
Top Bottom