Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: If msgbox is yes then checkbox is checked?

Geek News

If msgbox is yes then checkbox is checked?
Erin Freeman 12/2/2008 5:15:02 PM

Hi there

For some reason i cant get this code to work. On the "On Close" action of a
form, i want a checkbox to pop up to ask whether the data has been changed,
if the user chooses yes then i want my "revised" checkbox to populate with a
checkmark

'If MsgBox(" Have you revised this data?", vbYesNo) = vbYes Then
'Me.chkrevised = True

'End If

It doesnt seem to work, not sure what i am doing wrong. any help would be
greatly appreciated.

Thanks


RE: If msgbox is yes then checkbox is checked?
Michael Stanbarger 12/2/2008 5:24:07 PM
I would suggest creating a small form for this instead of using a MsgBox
script. This way you can bind it to the table that has the field you want to
change.




--
Michael Stanbarger
Air Freight Coordinator
CRST Van Expedited


"Erin Freeman" wrote:

[Quoted Text]
>
> Hi there
>
> For some reason i cant get this code to work. On the "On Close" action of a
> form, i want a checkbox to pop up to ask whether the data has been changed,
> if the user chooses yes then i want my "revised" checkbox to populate with a
> checkmark
>
> 'If MsgBox(" Have you revised this data?", vbYesNo) = vbYes Then
> 'Me.chkrevised = True
>
> 'End If
>
> It doesnt seem to work, not sure what i am doing wrong. any help would be
> greatly appreciated.
>
> Thanks
>
>
RE: If msgbox is yes then checkbox is checked?
Erin Freeman 12/2/2008 5:32:06 PM
not sure i follow you. the "revised: checkbox is currently on a form so when
the user tries to close the form, i should have a form pop up asking if they
have revised the data? i guess that makes sense... i will try that

"Michael Stanbarger" wrote:

[Quoted Text]
> I would suggest creating a small form for this instead of using a MsgBox
> script. This way you can bind it to the table that has the field you want to
> change.
>
>
>
>
> --
> Michael Stanbarger
> Air Freight Coordinator
> CRST Van Expedited
>
>
> "Erin Freeman" wrote:
>
> >
> > Hi there
> >
> > For some reason i cant get this code to work. On the "On Close" action of a
> > form, i want a checkbox to pop up to ask whether the data has been changed,
> > if the user chooses yes then i want my "revised" checkbox to populate with a
> > checkmark
> >
> > 'If MsgBox(" Have you revised this data?", vbYesNo) = vbYes Then
> > 'Me.chkrevised = True
> >
> > 'End If
> >
> > It doesnt seem to work, not sure what i am doing wrong. any help would be
> > greatly appreciated.
> >
> > Thanks
> >
> >
RE: If msgbox is yes then checkbox is checked?
Erin Freeman 12/2/2008 6:13:01 PM
Hi Michael,

So if i have a form that pops up when the main form is closed that asks if
the information has been revised, which works, however how do i get the popup
form to open to correct record, i have tried variaitions of code i could find
for filtering but for some reason i cant get it to work,

"Michael Stanbarger" wrote:

[Quoted Text]
> I would suggest creating a small form for this instead of using a MsgBox
> script. This way you can bind it to the table that has the field you want to
> change.
>
>
>
>
> --
> Michael Stanbarger
> Air Freight Coordinator
> CRST Van Expedited
>
>
> "Erin Freeman" wrote:
>
> >
> > Hi there
> >
> > For some reason i cant get this code to work. On the "On Close" action of a
> > form, i want a checkbox to pop up to ask whether the data has been changed,
> > if the user chooses yes then i want my "revised" checkbox to populate with a
> > checkmark
> >
> > 'If MsgBox(" Have you revised this data?", vbYesNo) = vbYes Then
> > 'Me.chkrevised = True
> >
> > 'End If
> >
> > It doesnt seem to work, not sure what i am doing wrong. any help would be
> > greatly appreciated.
> >
> > Thanks
> >
> >
Re: If msgbox is yes then checkbox is checked?
"BruceM" <bamoob[ at ]yawhodotcalm.not> 12/2/2008 8:38:33 PM
Maybe this would work in the form's Before Update event:

If Not Me.NewRecord Then
Me.Updated = True
End If

This assumes there is a Yes/No field named Updated. The Before Update event
runs only if the record has been revised. If you prevent it from running
for a new record it will run only if an existing record is changed. If it
is revised again there will be no way of knowing that, but that is also the
case if you ask the user to check a box. If the box is already checked it
could cause confusion. With the automated code no user action is required.

Another option is to create a Date/Time field. I will call it DateUpdated.
In the form's Before Update event:

If Not Me.NewRecord Then
Me.DateUpdated = Now
End If

This will record when the record was last changed.

"Erin Freeman" <ErinFreeman[ at ]discussions.microsoft.com> wrote in message
news:8CE7D356-45EE-4B5A-8826-49A2A4B505EA[ at ]microsoft.com...
[Quoted Text]
> Hi Michael,
>
> So if i have a form that pops up when the main form is closed that asks if
> the information has been revised, which works, however how do i get the
> popup
> form to open to correct record, i have tried variaitions of code i could
> find
> for filtering but for some reason i cant get it to work,
>
> "Michael Stanbarger" wrote:
>
>> I would suggest creating a small form for this instead of using a MsgBox
>> script. This way you can bind it to the table that has the field you want
>> to
>> change.
>>
>>
>>
>>
>> --
>> Michael Stanbarger
>> Air Freight Coordinator
>> CRST Van Expedited
>>
>>
>> "Erin Freeman" wrote:
>>
>> >
>> > Hi there
>> >
>> > For some reason i cant get this code to work. On the "On Close" action
>> > of a
>> > form, i want a checkbox to pop up to ask whether the data has been
>> > changed,
>> > if the user chooses yes then i want my "revised" checkbox to populate
>> > with a
>> > checkmark
>> >
>> > 'If MsgBox(" Have you revised this data?", vbYesNo) = vbYes Then
>> > 'Me.chkrevised = True
>> >
>> > 'End If
>> >
>> > It doesnt seem to work, not sure what i am doing wrong. any help would
>> > be
>> > greatly appreciated.
>> >
>> > Thanks
>> >
>> >

Re: If msgbox is yes then checkbox is checked?
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 12/2/2008 10:51:07 PM
Any change will be known by Access with the .dirty property.
You can just check the box without asking.
The only caveat is that *any* change marks the record dirty so if you change
"Fred" to "Bob" and then back to Fred it will trigger.
This can be beat by comparing the .previousvalue with the current value.

Erin Freeman wrote:
[Quoted Text]
> Hi there
>
> For some reason i cant get this code to work. On the "On Close"
> action of a form, i want a checkbox to pop up to ask whether the data
> has been changed, if the user chooses yes then i want my "revised"
> checkbox to populate with a checkmark
>
> 'If MsgBox(" Have you revised this data?", vbYesNo) = vbYes Then
> 'Me.chkrevised = True
>
> 'End If
>
> It doesnt seem to work, not sure what i am doing wrong. any help
> would be greatly appreciated.
>
> Thanks


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net