Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form appearing blank when no records to be displayed

Status
Not open for further replies.

Gresford

Programmer
Apr 3, 2002
10
0
0
GB
Hi
I've got a form for medical practices to fill in details of their team members.
At the top of the form is an unbound Year combo box, allowing user to select the year they want.
The team details are then contained in a subform. At the top of the subform is a list box with the team members registered for that year - and the rest of the subform shows details of the member currently selected from the list box (the listbox Update event has the standard Access code that the Wizard uses for these kind of navigating boxes - Set rs = Me.Recordset.Clone
rs.FindFirst "[TeamMemberID] = " & Str(Nz(Me![TeamList], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

The subform has buttons for users to add/delete members.
The problem is that if there are no members registered for a year, the subform appears completely blank - and so the user can't even see the Add button to register members for that year.
I just want the form to appear with all its fields blank (not allowing Additions directly) so that the user can click the Add button and register a new member.
Any suggestions? I'd be very grateful.
Cheers.
 
You need to put the buttons in the form footer or header.
Click View > From Header/Footer.
 
p27br. Thanks for this. But this still leaves me with the body of the form 'disappeared'. I would like all the usual fields to be showing - but just to be empty. Is it not possible to have the form appear as 'normal' (just empty) if there is no underlying record?
I suppose I could shift all the fields into either the header or the footer, but I can't help thinking there must be another way??
Thanks again.
 
I'd suggest on the afterUpdate event for the year field if you put some code to open a recordset that contains members for the selected year and check the number of records, and if = 0 then display a message box indicating no records for the particular year and exit.

Hope this helps.

Phil
 
Phil
If there are no records, I don't really want to exit. I just want all the normal fields on the form to be displayed without data, and let the user decide if they want to proceed with creating a new record by clicking the New button.
Following p27br's suggestion, I've stuck the Year select field, the Names listbox and the Add/Delete buttons in the Header of the form. This way, if the user selects a year without records, they at least see a blank Names box and a New button, so it is clear how they can add a record. Once a record is added, the remaining fields (in the Detail section) show up.
But it still seems a slightly funny way of doing things.
Thanks as ever.
Matthew
 
You can email the mdb to me so I can have a look at it.
kinenveut@email.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top