Navigation Buttons

smjohns

Registered User.
Local time
Today, 21:53
Joined
Mar 15, 2004
Messages
20
Navigation Buttons Help

Hi,

I have created a screen which lists all records and have two buttons on the screen to add a new record and amend an existing one. I also have a piece of code 'on activate" which does a me.refresh.

If I select a record using the navigation bar and then hit the amend button, a new screen is launched, to edit the record in full. On saving the changes and exiting the amend screen, the user is returned to the list screen, the data is refreshed, but importantly, the cursor remains on the navigation bar next to the record just updated. This is what I want.

The problem is when adding a new record. After creating a brand new record and I return to the list screen, I have to perform a me.requery, so that the record appears. Is there anyway to have the cursor on the navigation bar, default to this newly created record? I have the list ordered alphabetically at the mo, so the record could appear anywhere in the list.

Kind Regards

Simon
 
smjohns said:
Hi,

I have created a screen which lists all records and have two buttons on the screen to add a new record and amend an existing one. I also have a piece of code 'on activate" which does a me.refresh.

If I select a record using the navigation bar and then hit the amend button, a new screen is launched, to edit the record in full. On saving the changes and exiting the amend screen, the user is returned to the list screen, the data is refreshed, but importantly, the cursor remains on the navigation bar next to the record just updated. This is what I want.

The problem is when adding a new record. After creating a brand new record and I return to the list screen, I have to perform a me.requery, so that the record appears. Is there anyway to have the cursor on the navigation bar, default to this newly created record? I have the list ordered alphabetically at the mo, so the record could appear anywhere in the list.

Kind Regards

Simon

No ones answered yet so I'll try.

Have you investigated the 'SetFocusMethod' in VBA?
 
Look at the help topics on bookmark property. You'll find what you want to do there or here by searching "bookmark".
 
I am not sure if it is me being a bit thick, or just my inexperience with Access. Either way, I am struggling to work out how either method would work.

There are two routes, where a requery of Client_Setup screen is necessary and that is on clicking the save button and the close button on the Client_Add screen. This is where I also need to add my code so that the newly created record has the navigation arrow next to it, when you close the Client_Add screen.

I have never developed an application before, which is why this probable basic tasic is stumping me. Unfortunately, the compressed example file is 160k so I am unable to attach it here....Doh. Can I email it to one of you?

Kind Regards

Simon
 
Dim rs As String
rs = Forms!YourForm!YourID

DoCmd.RunCommand acCmdSaveRecord
Forms!YourForm.Requery
Forms!YourForm!YourID.SetFocus
DoCmd.FindRecord rs
 
Hi Rich,

I have tried your code, but I think I must be getting a little confused....DOH.

This is how I have coded it:

Dim rs As String
rs = "Forms!Client_Setup!" & Me!Client_ID & ""
'MsgBox rs
[Forms]![Client_Setup].Requery
Forms!Client_Setup!Client_ID.SetFocus
DoCmd.FindRecord rs

The setfocus seems to close the client_setup screen?
Where you put the "YourID" in your example, is this the client ID? I have a small problem in that the client ID (displayed) is formatted with 7 numbers (e.g. 0000012). So when you do a manual find, you need to search using the full string (0000012). As the Me!Client_ID raw data is just (12) then I assume I will have to format this, before adding it to the "rs" string?

The source data for the search value will be the client_id field on the Client_Addition screen. The field to be searched on the client_setup is client_id.

Just to confirm, BillyR is also having a look at this and I have emailed him a copy of my example DB. What you have above, looks like it should work but I am not experienced enough to know where it is going wrong.

Kind Regards

Simon
 

Users who are viewing this thread

Back
Top Bottom