How do I move to the next blank field after a requery?

E

efandango

I have a running quiz form using a dropdown box which is used to compare
answers, all works well, except for...

After I requery a form's underlying query, it goes back to the first record

I want it to go to the next blank field.

Below is the code (for now I have it set to go to Last record which is
preferable to goto first)

If Me.CurrentRecord >= 2 Then
Me.Requery
Me.Recordset.MoveLast

The combo box is: 'Combo_Answer_A'

The (field) control source is: AnswerA

The Form's Row Source is:
SELECT tbl_Final_Points_Test.Run_point_Address_A,
tbl_Final_Points_Test.Point_Quiz_ID FROM tbl_Final_Points_Test ORDER BY
tbl_Final_Points_Test.Run_point_Address_A;
 
L

Linq Adams via AccessMonster.com

After the requery command

DoCmd.GoToRecord , , acNewRec

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
E

efandango

That just creates a new record...; what I want is for the cursor to go to the
next blank 'Field', which is part of a query based form with the answer
missing, but by using the combo box, the user selects the correct answer
which matches the counterpart field on the form.
 
L

Linq Adams via AccessMonster.com

Sorry, but that really makes no sense! Why would you requery your form
between entering data in individual fields?

You can requery then return to the record you were working on with code like
this:

Dim hldID

hldID = Me!YourUniqueFieldName
Me.Requery
Me.Recordset.FindFirst "YourUniqueFieldName = '" & hldID & "'"

This assumes that YourUniqueFieldName is text datatype.

After returnng to the record, or perhaps in the FormCurrent event, you could
use code to loop thru all controls of the appropriate type until you find one
that's null, then set focus and exit the sub.

But as I said before, why are you requerying the form before you're thru
entering data in the record?
 
E

efandango

It would make sense to do just that if you were keeping a running score (it's
a quiz form). I will try your code suggestion, your help is appreciated.

thanks
 
E

efandango

your code just goes back to the first record after the requery.

You mentioned "use code to loop thru all controls of the appropriate type
until you find one that's null, then set focus and exit the sub."

the control is called: Combo_Answer_A
it's control source is:AnswerA

what code would loop/search for the next available Null record?
 

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