docmd.openform problem.

  • Thread starter Thread starter Lee Taylor-Vaughan
  • Start date Start date
L

Lee Taylor-Vaughan

Hi group,

I am trying to open a form by clicking on a record in a list box from on one
form. Once the record has been double-clicked that record is displayed on a
separate form.

under the double click event of the list box i have selected the
docmd.openform "frmName", critieria etc... to open the requested form;
however, when i double-click a record the form opens with blank record,
despite the 'where' clause in the docmd.openform statement. the big snag is
that if i double-click the record if the other form is in design vier then
it displays the correct record

This has be totally stumped... What do you think would cause this?

Please post your response so all can benefit...

thanks

Lee
 
thanks for your reply, but i just figured out why it would not work... the
forms 'DataEntry' was set to "Yes"! I am so happy that it is now working...
i can go on with my project....

thanks

Lee

Code if interested:

Private Sub OpenPatient()
On Error GoTo Err_OpenPatient_Click

If Not IsNull(Me.ControlNumberID) Then

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmPatients"

stLinkCriteria = "[ControlNumberID]=" & "'" & Me![ControlNumberID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms!frmpatients.ControlNumberID.Enabled = False
Forms!frmpatients.PatientRecID.Enabled = False
Else
MsgBox "You must enter the Control Number for this mission", vbCritical,
"Missing Data"
Me.ControlNumberID.SetFocus
End If


Exit_OpenPatient_Click:
Exit Sub

Err_OpenPatient_Click:
MsgBox Err.Description
Resume Exit_OpenPatient_Click

End Sub
 
Lee Taylor-Vaughan said:
thanks for your reply, but i just figured out why it would not work... the
forms 'DataEntry' was set to "Yes"!

That will cause what you saw, yes. Good work.
 
Back
Top