Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move Recordpointer on form

Status
Not open for further replies.

KatGraham

Programmer
Feb 12, 2003
58
US
How do I get a form's record pointer to point to the first record that is not complete?

Example:
dtmFrom cboComplete
1/1/04 Yes
1/5/04 Yes
1/7/04 No
1/10/04 No

I want the form to point to the record that has 1/7/04 - No.
 
Here are 2 ways of doing it. You can put this code on the Form Load event of the form that's being opened, and it will take you to the first record that is not complete:

1) Use a recordset and the criteria with the "FindFirst" method -------------

Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = Me.Recordset
rs.MoveFirst
rs.FindFirst "cboComplete = False"
Set rs = Nothing
Set db = Nothing

2) Use these two lines - go to the control for the cboComplete field; then use "False" as the value to find for that field -------------

DoCmd.GoToControl "cboComplete"
DoCmd.FindRecord "False"

Hope this helps!

Don
 
This code works...but....now I can't check or ununcheck any of the already checked boxes!

Help?
 
Sorry it took so long to get back...

Check 2 things -
1) Make sure the Allow Edits property on the form is set to true
2) Make sure the Enabled property is true and the Locked property is false on the cboComplete control

Don
 
I used:

DoCmd.GoToControl "cboComplete"
DoCmd.FindRecord "False"

and checked your 2 things...

Upon form open, I am brought direct to the first available false cboComplete. I can check any box I want. But I still can't UNCHECK any of the cboComplete boxes that I check.

Help?
 
Is cboComplete a check box or a combo box? I'm asking because usually a control name starting with 'cbo' is a combo box, but using a check box makes more sense.

If it is a check box you can add a combo box bound to the same field (just for testing). When you click the check box, the value in the combo box should toggle between 0 (false) and -1 (true).

I'm not sure what's going on. Make sure that the recordset type for the form is not set to 'Snapshot', and that there are no edit locks on the form or controls.

Anyone else have any suggestions??

Don
 
The field is really chkComplete. Sorry! It is a check box.

I changed the Record Type from Dynaset to Snapshot, what is the difference?

When I now try to click on any of the checkbox's, a message displays in the lower left hand side of the application: Searching....Press Ctrl+Break to stop

Any clues?
 
If the recordset type for the form is Snapshot, then the records can not edited. It will just display a static view of the table's data. When I did a test with a Snapshot recordset type, the status bar in the lower left says "This Recordset is not updateable"
Dynaset means that the records can be edited (provided the form allows edits and the control is not locked.)
If you want to send me a small db with just the table and form, I will try to figure out what's going on.
don@rdm-cc.com

Don
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top