Opening form on a specific record

colmtourque

Registered User.
Local time
Today, 11:18
Joined
Sep 26, 2002
Messages
83
I've seen several things on this topic so sorry if I am reasking. But nothing seems to work on my specific problem.
I have a form that opens filtered to specific records based on a subform. The subform is also based on a table. Currently what I have done is a query opens the subform. What I would like to happen instead is have the subform open with all possible records in the table but on a specific record is this possible.

I have found this command
DoCmd.GoToRecord
but unsure of how to write out the syntax in the forms on open event.
thanks
Kenneth
 
Hope this is useful

Go to the Forms button on the database window.

Select the form you will be working with

Right click on it and bring it up in 'Design View'

At the top there should be a ruler bar. Just to the left of the ruler bar is a gray sqare that looks like it's just a place holder but it is actually the forms handle (not a software handle though).

Right cllick on this square and it will bring up your form options.

Choose properties.

On the 'All' tab, scroll down to 'OnOpen'

Select [Event Procedure] from the drop down box.

A box with three or four dots should pop up next to the drop down box.

Click this box and it will open the coding window and build the outline for the Form_open function for you.

Inside here type something like

DoCmd.FindRecord "Smith", ,true,,true

or whatever you are looking for besides "Smith". Numerics don't need quotes....

The extra commas are supposed to be there. this is callling the class with 5 arguments.

Good luck
PB
 
addendum

I didn't understand your entire question. The previous post will open on a specific record but I'm not sure about the sub Form sfuff. Sorry if I wasted your time.
PB
 
Basically I want a subform to open on a specific recordset, but still be able to advance backwards and forwards within the table.

I know how to create a form off a query, or filter where it will open on a specific record, but then your either limited to the query results or have to remove the filter.

Does that make more sense.

I tried your suggestion but I am not sure if it will work. The field it is running on is a date.

What I am completly looking for is to open the Form between dates in a two week time period, the dates of which sit in two fields (one field is the earlier date, and the other the later date)

Sorry I did not type all that prior but I was hoping to get pointed in the right direction and then to be able to take it from there.

To help the query I am currently using to base the form off is:

SELECT [Staff: Time Card Periods].[First Date], [Staff: Time Card Periods].[End Date]
FROM [Staff: Time Card Periods]
WHERE ((([Staff: Time Card Periods].[First Date])<=Date()) AND (([Staff: Time Card Periods].[End Date])>=Date()));

Thanks again
Colm
 
Last edited:
Someone please let me know if my question makes no sense. Because I can't find any method to do this. And I know it must be somehow possible.
 

Users who are viewing this thread

Back
Top Bottom