One more question about a popup

KCA

Registered User.
Local time
Today, 23:16
Joined
Mar 29, 2002
Messages
24
Ok, I got everything working from my previous questions, thanks a lot for that...

But, one more thing, in my main table I have a few fields which I don't want to show on my main form, in fact on these field the user has to sign off for the data he entered. These values just need to be entered in the table so I can refer to them later via reports or so or for other forms.

I want him to select a field which will activate a button, so far so good, then the button opens a pop-up form where he signs with name - number - date and time. Here it goes wrong. The pop-up opens, but does not refer to the actual record and I can't find how to refer to it. I put a link to the main form ID (autonumber) to check which record it's going to, but the records don't always match and I can't get a pattern in what it's returning.

I could use a new table of course just for these sign-offs, but since it's a one-to-one with my main table I didn't see the use of it, or should I use this way to get the data sorted ?? The problem I see is that I have 5 more or less similar pop-ups like this one, so that would mean 5 extra tables.
 
Can't you just open the pop-up to the same ID as the main form?
 
Well, that's what I'm trying. Let's say for example I'm on record #17 on my main form and want to sign off. So I click the button and the pop-up opens. The values I enter in here should also be stored in record #17, but for this the pop-up should open first on the current record# and that's exactly what it refuses to do... If I have the record selectors active in the pop-up I can cycle through all records while the main form stays on the selected record, for example #17. It looks to me that the main form becomes inactive or so and the pop-up takes over, while the pop-up should only be extra info to store in this specific record selected on the main form and also be limited to this. So I think I need to refer one way or another to the autonumber in the main form, make sure that via the pop-up I can only put data in the selected record and when closing the pop-up make sure the data is actually saved... But... can't find how to do this. Tried already a few things, while still being careful not to mess up the rest of my form, like for the pop-up some onopen,current,afterupdate events, but they don't give the result I want. As I said in a previous thread already, I'm just very basic with code...

I'm sure I can get it to work with a separate table but... I prefer not to for the moment unless you guys tell me to do so.
 
No, you don't need a separate table. Here's what you need to do.

On your pop-up take away any method the user can use to cycle through records. You don't want that. Set its Popup and Modal properties to 'Yes'. That will prevent the users from using both forms at the same time. Otherwise you'd have other problems to deal with.

Now setup a procedure like this:

Private Sub cmdButton_Click()

DoCmd.RunCommand accmdSaveRecord
'This is important when you're going to open a separate form on the same record.

DoCmd.OpenForm "Pop up form name", , ,"[Name of Id Field]=" & Me![Name of ID Field]


That will open the form to the active record in the main form.
 
Thank you very much !!!!!!
Working perfect now...
 

Users who are viewing this thread

Back
Top Bottom