Pop-up form with some fields pre-filled

Birdman895

Registered User.
Local time
Today, 03:21
Joined
Apr 19, 2012
Messages
62
I am trying to develope a form (called ContactNote), to enter a note into. Basically it is for a note that a Dr/Therapist needs to enter each time they have contact with a patient/client. I want it to be a pop-up that can be accessed from any screen. The ContactNote table has the field fk_ClientID, and most of the screens (forms) where they will be launching this Form from will have either ClientID or fk_ClientID available.
1. how can I open this form with the field ContactNote.fk_ClientID already filled with the current ClientID, and still open it in Add new record so that they can only enter one new record? (I have looked at Appending a new record into tblContactNote with the current ClientID value, and then using OpenForm with the Where statement to locate that new record, but no luck so far)

2. If the ClientID isn't available from the ActiveForm then I want to prompt them for a value(I think i have that one already)

I have a feeling that it's going to be a simple answer but I'm tired of banging my head against the wall
 
You could parse the ClientID to the forms OpenArgs property in the code used to open the form. When the form closes, check for some text in the notes and then use the OpenArgs value to to populate the field or prompt the user if OpenArgs is null.
 
Thanks Bob
I've gotten it working this way;
I declared a module level variable called ThisRecord (most of my code so far is at Form level). then in the code that opens the dialog I have,

ThisRecord = [fk_ClientID].Value
DoCmd.OpenForm "frmContactNote_dialog", acNormal, "", "", acFormAdd, acDialog.

Then on the form thats opening I have,

Private Sub Form_Load()
fk_ClientID = ThisRecord
DoCmd.Requery "[fk_ClientID]"

It's working so far but I think that the OpenArgs approach gives a lot more flexability.
Thanks again
 

Users who are viewing this thread

Back
Top Bottom