I found this post from 08/28/09 in which FredG supplied this code, I replaced
ID with my MyTransID which is my autonumberfield and primaryID key for this
query from tbltransactions.
Private Sub cmdRefresh_Click()
Dim MyId As Long
MyId = Me.MyTransID
Me.Requery
Me.MyTransID.SetFocus
DoCmd.FindRecord MyId, acEntire, , acSearchAll, , acCurrent
End Sub
I get an error and highlighted is SetFocus.
|
|
0
|
|
|
|
Reply
|
Utf
|
12/3/2009 10:34:06 PM |
|
It's possible that the name of the field on your form is not necessarily
MyTransID. In design view on the properties view for your field, go to the
Other tab and see what is in the Name field. It could be something like
Text04. That's what you need to put in your reference.
As you have it, you are referring to the field name as it is in the
table/query, not as it may be on the form. If you want to have meaningful
names for fields on your form, try using a prefix such as "txt" for text
boxes, "cbo" for combo boxes, etc etc., so your form field name might be
txtMyTransID.
"Anne" wrote:
> I found this post from 08/28/09 in which FredG supplied this code, I replaced
> ID with my MyTransID which is my autonumberfield and primaryID key for this
> query from tbltransactions.
>
> Private Sub cmdRefresh_Click()
> Dim MyId As Long
> MyId = Me.MyTransID
> Me.Requery
> Me.MyTransID.SetFocus
> DoCmd.FindRecord MyId, acEntire, , acSearchAll, , acCurrent
> End Sub
>
> I get an error and highlighted is SetFocus.
|
|
0
|
|
|
|
Reply
|
Utf
|
12/3/2009 10:44:01 PM
|
|
That was it. Thanks,
"Pendragon" wrote:
> It's possible that the name of the field on your form is not necessarily
> MyTransID. In design view on the properties view for your field, go to the
> Other tab and see what is in the Name field. It could be something like
> Text04. That's what you need to put in your reference.
>
> As you have it, you are referring to the field name as it is in the
> table/query, not as it may be on the form. If you want to have meaningful
> names for fields on your form, try using a prefix such as "txt" for text
> boxes, "cbo" for combo boxes, etc etc., so your form field name might be
> txtMyTransID.
>
> "Anne" wrote:
>
> > I found this post from 08/28/09 in which FredG supplied this code, I replaced
> > ID with my MyTransID which is my autonumberfield and primaryID key for this
> > query from tbltransactions.
> >
> > Private Sub cmdRefresh_Click()
> > Dim MyId As Long
> > MyId = Me.MyTransID
> > Me.Requery
> > Me.MyTransID.SetFocus
> > DoCmd.FindRecord MyId, acEntire, , acSearchAll, , acCurrent
> > End Sub
> >
> > I get an error and highlighted is SetFocus.
|
|
0
|
|
|
|
Reply
|
Utf
|
12/3/2009 10:54:01 PM
|
|
|
2 Replies
415 Views
(page loaded in 0.035 seconds)
Similiar Articles: How to requery a form on activate without move from current record ...... some record set updates and then return to form ... just requery the form = in the VBA ... Lock Current record on a 'continuous ... other form using primary key ..... your last ... Delete on Continuous form gives error 2046 - microsoft.public ...The action queries fire but I get the runtime error ... I've not ... continuous form - shows 1st record not last ... Web refresh/requery underlying table from Form delete ... Trigger Subform "On Current" from Parent Form "On ...how to requery on new record continuous form - microsoft ... Parent property to return the name of its parent form. ... the ... get an error that says there is no Current Record >in ... Deleting subform record causes form record to be deleted ...Error 3167 Record is deleted ... subform in continuous view, sometimes the subform has records to ... form's ... Delete a record from a dialog and requery the form. using NZ() function to return ''0'' value when ...... Sub cmdsave_Click() On Error GoTo Err_cmdsave_Click Me.countrack.Requery Me ... Requery Me.trcount1.Requery If Nz(Me.countrack.Form.dtrack ... back to 0 when the first record ... Will not go to New Record in a subform. - microsoft.public.access ...... would use ... to specific record in continuous subform ... Go to the last-new row in a datasheet ... Enable SubForm new record entry at top of Form ... Requery a form from its ... Requery sort order on a Form - microsoft.public.access... go to a specific record within continuous forms - microsoft ..... sort, requery ... District, Last_Name"; if( !rsCustSet.CanRestart( ) ) return; // Unable to requery if ... Showing list on continuous forms - microsoft.public.access.forms ...Last Record On A Continuous Form (Problem ... how to requery on new record continuous form - microsoft ... Form Printing Error - microsoft.public.access.forms Access ... How to go to a specific record within continuous forms - microsoft ...... you tab past the last control, close the form, apply a filter, change the sort, requery ... seemingly weird errors ... how to requery on new record continuous form ... Set Current Row in SubForm datasheet - microsoft.public.access ...Viewing the current record after requery a form - microsoft.public ... ... 12th Apr 2007 07:35 PM: set focus to last ... When you have a form with a continuous forms or datasheet ... Continuous form refresh/requery DataBase... REQUERY, how do I get the record indicator to land on the NEW record in the continuous form? (Note: due to sort order, the new record will NOT be last ... errors ... return ... Using MS Access: requery main form from pop-up form after update ...Using MS Access /requery main form from pop-up form after update and return to newly selected record ... I have a continuous form that pulls ... Run on my own for the last ... vba - In an Access form, how to return to previous record after ...... use of property" error message on this last ... Me.CurrentRecord returns a number representing the position in the record. Since a requery ... In Access Continuous Form, how do ... Visual Basic :: Form Requery In Access - BigResource: Webmaster ...Form Requery In Access Hi All I have continuous form set up in an access db. ... datagrid, when i click my last record ... what will happen if the .Requery will return 0 records ... When to requery main (continuous) form after adding new recordMicrosoft Access Forms: 0: 27th Apr 2010 09:00 PM: Requery and return to last record on continuous form error: Anne: Microsoft Access Form Coding: 2: 3rd Dec 2009 10:54 PM 7/17/2012 9:01:54 PM
|