Continuous Form / Updating Current Record (1 Viewer)

gfultz

Registered User.
Local time
Today, 12:36
Joined
Dec 18, 2009
Messages
51
Hi All,

Obviously I cannot use vba to update a record by using a simple me.control = blah because it will update all of the records. However, is there a way to grab the PK of the record so that I could use it to run an update query? I just want to be sure I am grabbing the PK from the current record. This is present on my form.

Thanks!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:36
Joined
Aug 30, 2003
Messages
36,126
I think your premise is wrong. Using Me.whatever will change the value of the record with focus, not all records. That is unless the control is unbound, which of course wouldn't update any records anyway.
 

gfultz

Registered User.
Local time
Today, 12:36
Joined
Dec 18, 2009
Messages
51
Hmmmm... That's what I intially thought...More testing has revealed that it seems to be occurring if you go to the new record and then update the Remarks and say yes to the prompt to update the Last Contact Date Field. I will test some more... But the field is definitely bound...
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:36
Joined
Aug 30, 2003
Messages
36,126
If you're getting a prompt, it sounds like there's some code running or something. If you're still stuck, can you post the db?
 

missinglinq

AWF VIP
Local time
Today, 15:36
Joined
Jun 20, 2003
Messages
6,423
Paul's remarks are dead on! This prompt is nothing native to Access, which means it has to have been programmed into the database. Is this an app you created or one that you've inherited from another developer?
 

gfultz

Registered User.
Local time
Today, 12:36
Joined
Dec 18, 2009
Messages
51
I programmed this. Essentially, when the user updates the Remarks field, a prompt asks if they'd like to update the Last Contact Date. If they click yes, it sets Me.LCD.Value = Date. If no, it does nothing.

The issue is apparently a non issue as I can no longer produce the problem.

I have been testing extensively tonight and it is working fine in everyway. Sorry for the bother...
 

missinglinq

AWF VIP
Local time
Today, 15:36
Joined
Jun 20, 2003
Messages
6,423
Borrowing shamelessly from the U.S. Navy, Access programming is "Not a job, it's an adventure!" Access VBA is an incredibly complex language! Most experienced developers, if they're honest, will tell you that after 10, 15 or even 20 years working in Access, they still learn something new most every week! And the more complex a language is, the more it is prone to occasional fits and starts, frequently without any rhyme or reason!

At any rate, glad that it's working again!
 

Users who are viewing this thread

Top Bottom