Form Refresh Problem

J

Jeff C

I have a form bound to a table with records based on a date. I have an
unbound text box tied to a calendar form. The GotFocus event runs SQL that
appends the chosen date to the table.

I then move to a combo box to select the date I want to work with, or I can
just begin by choosing a date in the combo box. Basically what I am doing is
using the form to hold command buttons for stepping through a process. On
each button the process runs, a check box for each step is changed to yes,
and the form is refreshed making the checkbox change visible on the form.

I have two problems. First, after I have run through several steps, if I
return to the combo box to choose a different date record, the record does
not change to the current date chosen. The afterupdate event hold the code to
associate the records in the table to the value in the combo box which will
work initially. I also added code to refresh the form data after that. It
still will not work.
Here is the afterupdate event:

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PayrollRegisterDate] = #" & Format(Me![RegisterDate],
"mm\/dd\/yyyy") & "#"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

The second problem. Is there a way to make these check boxes uneditable on
the form so that clicking them does nothing, I do not want them accidently
changed from no to yes or visa-versa?

Thank you.
 
C

Corey-g via AccessMonster.com

I'm not too sure about the first part with the combo box, I don't fully
unbderstand what your doing, but the second part is easy - just set the check
box(es) Locked property to true, then they can't be changed manually

Jeff said:
I have a form bound to a table with records based on a date. I have an
unbound text box tied to a calendar form. The GotFocus event runs SQL that
appends the chosen date to the table.

I then move to a combo box to select the date I want to work with, or I can
just begin by choosing a date in the combo box. Basically what I am doing is
using the form to hold command buttons for stepping through a process. On
each button the process runs, a check box for each step is changed to yes,
and the form is refreshed making the checkbox change visible on the form.

I have two problems. First, after I have run through several steps, if I
return to the combo box to choose a different date record, the record does
not change to the current date chosen. The afterupdate event hold the code to
associate the records in the table to the value in the combo box which will
work initially. I also added code to refresh the form data after that. It
still will not work.
Here is the afterupdate event:

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PayrollRegisterDate] = #" & Format(Me![RegisterDate],
"mm\/dd\/yyyy") & "#"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

The second problem. Is there a way to make these check boxes uneditable on
the form so that clicking them does nothing, I do not want them accidently
changed from no to yes or visa-versa?

Thank you.
 
A

Alex Dybenko

Hi,
have you tried to debug your code?
I would adjust it, using DAO explicitly (make sure that you have a reference
to DAO)

Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[PayrollRegisterDate] = #" & Format(Me![RegisterDate], >
"mm\/dd\/yyyy") & "#"
If Not rs.nomatch Then Me.Bookmark = rs.Bookmark

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top