Requery or limit the number of records on a form

magister011

Registered User.
Local time
Today, 12:20
Joined
Aug 18, 2009
Messages
17
I have a problem that I have searched but I have not quite found an answer yet. I have Access 2003.

In the database I have a form with a tab control of two tabbed forms. One form is a justified form that I am using to just enter data and it's record source is linked to a table.

The other form is a tabular layout form with a continuous forms view which is linked to a query from the same table as above.

What I want to do is be able to have the user go to the tabular layout form whenever they want to and have it requery automatically, but every event that I have tried, I cannot seem to get it to work, except the timer event. Also with the timer event it will requery and only show the very last record and I would like it to show the latest records the user have entered instead of the very first record. I have about 300 records in the database. Is there anyway to do this in Access 2003 and if so how? I am fairly new and learning as I go.

Thanks
magister011
 
base the displayed form on a query that sorts the records in the order you want (ie reverse date order)
 
Also, your requery can go in the tab control's ON CHANGE event. I assume you maybe tried the Click event which is pretty much a useless event. For Tab controls, the on change event is the main one to use.
 
OK, I have the Tab Control Event working, but I still cannot get the records to sort decsending. I think may be the problem. On the continuous form I have an edit button for each record that works off the On Click Event. This will take the user back to the other form and is able to make any edits. Here is the code for that button:

'This is the code to get the continuous form and the product form in synch with
'each other. It also enables the use of the edit button on the continuous form
'to gain access to the product entry form.

Private Sub cmdSelProd_Click()
Dim Mat_Name
Mat_Name = Me!Pdt_Pk
Parent!Pdt_Pk.SetFocus
DoCmd.FindRecord Mat_Name
Parent!Pdt_MakFK.SetFocus
End Sub

My Primary key is the Pdt_Pk in the Product table. I can change the sort order in my queries but it will not carry of to the continuous form.

magister011
 
Is this a major problem that can be fixed or do I just have to live with it? Your help is surely appreciated! :D

magister011
 
My Primary key is the Pdt_Pk in the Product table. I can change the sort order in my queries but it will not carry of to the continuous form.
Don't know why it wouldn't. It always has for me. Are you absolutely sure you are putting the correct sort in to the query and then saving it? Continous, Datasheet, and single form should all work with the sort order from a query. Make sure there is nothing in the form's ORDER BY property that could be overriding it.
 
I will have to check that out tomorrow at work. I only have Access 2000 at home. I will let you know what I find out.

Thanks
magister011
 
I was able to get it working. I had a line of code in the ON LOAD event that was sorting the records. I removed it and the requery worked perfect. Thank you so much. I appreciate it.

magister011 :D
 
Yep, code in other places definitely can cause a problem (sometimes a real pain trying to find where it is). Glad you got it sorted :)
 

Users who are viewing this thread

Back
Top Bottom