If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Return to field
I'm trying to check that a value is not already in the table - this is what I
have put together so far using previous posts: Private Sub Procedure_Number_AfterUpdate() If (DLookup("[Procedure_Number]", "[T_Procedures]", "[Procedure_Number]=" & Me.[Procedure_Number])) Then MsgBox "procedure number exists" Cancel = True Me.Undo Me.[Procedure_Number].SetFocus End If End Sub I want the focus to return to the field if the procedure number already exists but it's not happening - everything else seems to work OK so I'd be most grateful for any help finishing this off. I don;t know much about vb so please be gentle! SSheila |
#2
|
|||
|
|||
Return to field
move the checking to the before update event - then itshould never loose
focus so you won't need to set it's focus "Sheila D" wrote: I'm trying to check that a value is not already in the table - this is what I have put together so far using previous posts: Private Sub Procedure_Number_AfterUpdate() If (DLookup("[Procedure_Number]", "[T_Procedures]", "[Procedure_Number]=" & Me.[Procedure_Number])) Then MsgBox "procedure number exists" Cancel = True Me.Undo Me.[Procedure_Number].SetFocus End If End Sub I want the focus to return to the field if the procedure number already exists but it's not happening - everything else seems to work OK so I'd be most grateful for any help finishing this off. I don;t know much about vb so please be gentle! SSheila |
#3
|
|||
|
|||
Return to field
Thanks Danny, works a dream
"Danny Seager" wrote: move the checking to the before update event - then itshould never loose focus so you won't need to set it's focus "Sheila D" wrote: I'm trying to check that a value is not already in the table - this is what I have put together so far using previous posts: Private Sub Procedure_Number_AfterUpdate() If (DLookup("[Procedure_Number]", "[T_Procedures]", "[Procedure_Number]=" & Me.[Procedure_Number])) Then MsgBox "procedure number exists" Cancel = True Me.Undo Me.[Procedure_Number].SetFocus End If End Sub I want the focus to return to the field if the procedure number already exists but it's not happening - everything else seems to work OK so I'd be most grateful for any help finishing this off. I don;t know much about vb so please be gentle! SSheila |
Thread Tools | |
Display Modes | |
|
|