Opening form with blank view

petebevans

New member
Local time
Today, 21:37
Joined
Jun 9, 2008
Messages
9
I have designed a form to display patient treatment records. The main form has various fields which are not enabled to prevent data editing. An unbound combo box is used to select a patient to display. Both the main form and the sub form have the 'Data Entry' property set to 'No'.The main form is linked to a subform displayed within the main form which allows entry of treatment records. My problem is that although when the form opens, the combo box to select the patient is blank (ie before I select a record from the combo box), the rest of the main form and sub form is populated with the first patient's records from the underlying table. If I set the forms' Data Entry properties to 'Yes' the combo box no longer works when I select a patient to view. The combo box was generated using the wizard and selecting 'Find a record on my form based on the value I select in my combo box'. In short I want the Data Entry property set to 'Yes' to display a blank form on opening but at the same time to 'No' to allow the combo box to select a record. I am sure there must be some code I can insert somewhere to get the form to work but I haven't a clue as to what and where!:confused:
 
I would suggest removing the RecordSource of the form and then set it in the OnEnter event of the ComboBox.
 
I would suggest removing the RecordSource of the form and then set it in the OnEnter event of the ComboBox.
Hi RG,
Thanks for the prompt reply. I see where you are coming from but could you give me more detail on what the OnEnter event needs to do in the ComboBox? An example bit of code would make it clear to my tiny brain!
 
Assuming you have a query as the RecordSource of your form (you do don't you), then the OnEnter event looks something like:
Me.RecordSource = "YourQueryName"
Have you written code for an event before? What version of Access are you using?
 
OK i'm not to good at this but what i think you have to do is get rid of the data entry yes part, and to make the form unpopulated when you open it you need to change the code behind the button to "open acnew" <--- or something like that.

that way it is opening the form at a new record and as you have data entry set to yes it will not allow you to select any previous data, switching this to no will allow you to populate the fields with the selected data from the combo box


sorry misread the query :-(
 
Hi Makaveli,
I have previously tried messing around with the 'open acnew' approach without success. I think I might nearly be there with RuralGuy's idea.
 
Assuming you have a query as the RecordSource of your form (you do don't you), then the OnEnter event looks something like:
Me.RecordSource = "YourQueryName"
Have you written code for an event before? What version of Access are you using?
Hi RG,
I have done a little event coding. The original form has the Record Source set to the PatientDetails table. Would this make the necessary code something like Me.RecordSource = !Table!PatientDetails ? I'm using Access 2003 by the way.
 

Users who are viewing this thread

Back
Top Bottom