 |
|
 |
|
Next: 2009 Top 10 Software Reviews
|
| Author |
Message |
External

Since: Dec 27, 2008 Posts: 2
|
(Msg. 1) Posted: Sun May 03, 2009 8:44 pm
Post subject: Problems after enter press. Archived from groups: microsoft>public>access (more info?)
|
|
|
Hello all.
I have this code, but when I enter a value and press enter, the set focus
goes directly to first line of the records of the subform,
I think the problem is the setfocus event, but how can I solve this?
Thanks in advanced.
=============================
Private Sub DT_Min_AfterUpdate()
Me.Recalc
If ([Forms]![frm_Production_Report]![TSum]) > 60 Then
MsgBox "You can't report a value greater that 60 Minutes!", vbCritical,
"Error, exceed value"
'Delete value
Me.DT_Min = "1"
'pass code
Me.DT_Code.SetFocus
'focus
Me.DT_Min.SetFocus
ElseIf IsNull(Me.DT_Min) Or Me.DT_Min < 1 Then
MsgBox "Zero or Null value, select a value beetween 1 and 60", vbCritical,
"Zero or Null value error"
'Delete value
Me.DT_Min = "1"
'pass code
Me.DT_Code.SetFocus
'focus
Me.DT_Min.SetFocus
Else
Me.Comments.SetFocus
End If
End Sub
============================= >> Stay informed about: Problems after enter press. |
|
| Back to top |
|
 |  |
External

Since: Apr 7, 2009 Posts: 5
|
(Msg. 2) Posted: Mon May 04, 2009 8:27 am
Post subject: Re: Problems after enter press. Archived from groups: per prev. post (more info?)
|
|
|
It is not clear what you are trying to do. What I see is that in the After
Update event of the control DT_Min you are checking the value in the TSum
field or control on another form (frm_Production_Report). If the current
form is frm_Production_Report you can just use the Me prefix: Me.TSum.
You say you are deleting the value, but then you set it to 1. After that
you set control to DT_Code, then to DT_Min.
If you need to validate the entry in a control, use the Before Update event,
which can be canceled. After Update may be too late for your needs.
Private Sub DT_Min_BeforeUpdate()
If Me.DT_Min > 60 Then
MsgBox "60 maximum"
Cancel = True
End If
If this does not address the problem, describe what you hope to accomplish.
Include names of controls. I usually name the control something other than
the field name (e.g. txtDT_Min) to avoid confusion, both for myself and
Access, which can in some cases become addled when trying to deal with a
field and control that share the same name.
"ldiaz" wrote in message
>
> Hello all.
> I have this code, but when I enter a value and press enter, the set focus
> goes directly to first line of the records of the subform,
>
> I think the problem is the setfocus event, but how can I solve this?
> Thanks in advanced.
> =============================
> Private Sub DT_Min_AfterUpdate()
> Me.Recalc
>
> If ([Forms]![frm_Production_Report]![TSum]) > 60 Then
> MsgBox "You can't report a value greater that 60 Minutes!", vbCritical,
> "Error, exceed value"
> 'Delete value
> Me.DT_Min = "1"
> 'pass code
> Me.DT_Code.SetFocus
> 'focus
> Me.DT_Min.SetFocus
>
> ElseIf IsNull(Me.DT_Min) Or Me.DT_Min < 1 Then
>
> MsgBox "Zero or Null value, select a value beetween 1 and 60", vbCritical,
> "Zero or Null value error"
> 'Delete value
> Me.DT_Min = "1"
> 'pass code
> Me.DT_Code.SetFocus
> 'focus
> Me.DT_Min.SetFocus
>
>
> Else
> Me.Comments.SetFocus
> End If
>
>
> End Sub
> =============================
>
> --
> Lorenzo Díaz
> Cad Technician >> Stay informed about: Problems after enter press. |
|
| Back to top |
|
 |  |
External

Since: Dec 27, 2008 Posts: 2
|
(Msg. 3) Posted: Wed May 06, 2009 10:05 am
Post subject: Re: Problems after enter press. Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Apr 7, 2009 Posts: 5
|
(Msg. 4) Posted: Thu May 07, 2009 7:14 am
Post subject: Re: Problems after enter press. Archived from groups: per prev. post (more info?)
|
|
|
I have not been able to duplicate the problem. How are you running the
code, and for what reason?
"ldiaz" wrote in message
> it's now fixed, thanks
>
> right now I have a similar problem.
>
>
> how can I make this operation:
> me.form.recalc
>
> without lost the setfocus on the row?
>
> Thanks
> LD
>
> --
> Lorenzo Díaz
> Cad Technician
>
>
> "BruceM" wrote:
>
>> It is not clear what you are trying to do. What I see is that in the
>> After
>> Update event of the control DT_Min you are checking the value in the TSum
>> field or control on another form (frm_Production_Report). If the current
>> form is frm_Production_Report you can just use the Me prefix: Me.TSum.
>>
>> You say you are deleting the value, but then you set it to 1. After that
>> you set control to DT_Code, then to DT_Min.
>>
>> If you need to validate the entry in a control, use the Before Update
>> event,
>> which can be canceled. After Update may be too late for your needs.
>>
>> Private Sub DT_Min_BeforeUpdate()
>>
>> If Me.DT_Min > 60 Then
>> MsgBox "60 maximum"
>> Cancel = True
>> End If
>>
>> If this does not address the problem, describe what you hope to
>> accomplish.
>> Include names of controls. I usually name the control something other
>> than
>> the field name (e.g. txtDT_Min) to avoid confusion, both for myself and
>> Access, which can in some cases become addled when trying to deal with a
>> field and control that share the same name.
>>
>>
>> "ldiaz" wrote in message
>>
>> >
>> > Hello all.
>> > I have this code, but when I enter a value and press enter, the set
>> > focus
>> > goes directly to first line of the records of the subform,
>> >
>> > I think the problem is the setfocus event, but how can I solve this?
>> > Thanks in advanced.
>> > =============================
>> > Private Sub DT_Min_AfterUpdate()
>> > Me.Recalc
>> >
>> > If ([Forms]![frm_Production_Report]![TSum]) > 60 Then
>> > MsgBox "You can't report a value greater that 60 Minutes!", vbCritical,
>> > "Error, exceed value"
>> > 'Delete value
>> > Me.DT_Min = "1"
>> > 'pass code
>> > Me.DT_Code.SetFocus
>> > 'focus
>> > Me.DT_Min.SetFocus
>> >
>> > ElseIf IsNull(Me.DT_Min) Or Me.DT_Min < 1 Then
>> >
>> > MsgBox "Zero or Null value, select a value beetween 1 and 60",
>> > vbCritical,
>> > "Zero or Null value error"
>> > 'Delete value
>> > Me.DT_Min = "1"
>> > 'pass code
>> > Me.DT_Code.SetFocus
>> > 'focus
>> > Me.DT_Min.SetFocus
>> >
>> >
>> > Else
>> > Me.Comments.SetFocus
>> > End If
>> >
>> >
>> > End Sub
>> > =============================
>> >
>> > --
>> > Lorenzo Díaz
>> > Cad Technician
>>
>>
>> >> Stay informed about: Problems after enter press. |
|
| Back to top |
|
 |  |
| Related Topics: | Remove ''Enter Parameter Value'' - I deleted like 10 field names in my Employees table. When I want to go in my Employees form, ''Enter Parameter Value'' pops up for each field names I deleted, so 10 times. I usually go in the desgin view of that form, in the record source and delete..
Wildcard for Enter Parameter Value Box? - for example.. when you type in: [Enter Item_ID) The enter Parameter Value box appears asking for the Item ID How would I set it up so only a wild card would need to be entered intead of the full item name?
Microsoft Office - Can you update Microsoft office version 2003 to 2007 or do you have to buy the newer version
From access to word - Print - Hello, We open word letter from access with hiperlink code. . . .. . . Application.FollowHyperlink "h:\DRISHOT\" & lettername & ".doc" Is it possible to print the letter instead of open it ? How ? thank you
the setting for this property is too long - Hello. I was running the Access performance option and for some forms and reports there was a message with this: the setting for this property is too long what is this? what should I fix in order to not receive this error. Regards, Marco |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|