Private Sub SupplierSKUCode_AfterUpdate()
If Nz(DLookup("SupplierSKUCode", "tblProduct", "SupplierSKUCode='" & _
Me.SupplierSKUCode & "'"), "zzzz") <> "zzzz" Then MsgBox "SupplierSKUCode Already Exist.", vbCritical
If MsgBox("Duplicate Record." _
& vbCrLf & vbCrLf & "Do you want to have Duplicate Record?" _
, vbYesNo, "Changes Made...") = vbYes Then
Me.ProductDescription.SetFocus
Else Me.SupplierSKUCode.SetFocus
DoCmd.RunCommand acCmdUndo Me.SupplierSKUCode.SetFocus
End If
'Test if control contains text
If IsNull(Screen.ActiveControl) = False Then
'convert text to Proper Case
Screen.ActiveControl = StrConv(Screen.ActiveControl, vbUpperCase)
End If
End Sub
The set focus doesnt seem to work, please help me whats wrong with my coding..tnx
10 2336
Private Sub SupplierSKUCode_AfterUpdate()
If Nz(DLookup("SupplierSKUCode", "tblProduct", "SupplierSKUCode='" & _
Me.SupplierSKUCode & "'"), "zzzz") <> "zzzz" Then MsgBox "SupplierSKUCode Already Exist.", vbCritical
If MsgBox("Duplicate Record." _
& vbCrLf & vbCrLf & "Do you want to have Duplicate Record?" _
, vbYesNo, "Changes Made...") = vbYes Then
Me.ProductDescription.SetFocus
Else Me.SupplierSKUCode.SetFocus
DoCmd.RunCommand acCmdUndo Me.SupplierSKUCode.SetFocus
End If
'Test if control contains text
If IsNull(Screen.ActiveControl) = False Then
'convert text to Proper Case
Screen.ActiveControl = StrConv(Screen.ActiveControl, vbUpperCase)
End If
End Sub
The set focus doesnt seem to work, please help me whats wrong with my coding..tnx
Why are you setting the focus?
Re: SetFocus Doesnt Seem to be Working.
Quote:
Originally Posted by rockdc1981
Private Sub SupplierSKUCode_AfterUpdate()
If Nz(DLookup("SupplierSKUCode", "tblProduct", "SupplierSKUCode='" & _
Me.SupplierSKUCode & "'"), "zzzz") <> "zzzz" Then MsgBox "SupplierSKUCode Already Exist.", vbCritical
If MsgBox("Duplicate Record." _
& vbCrLf & vbCrLf & "Do you want to have Duplicate Record?" _
, vbYesNo, "Changes Made...") = vbYes Then
Me.ProductDescription.SetFocus
Else
Me.SupplierSKUCode.SetFocus
DoCmd.RunCommand acCmdUndo
Me.SupplierSKUCode.SetFocus
End If
'Test if control contains text
If IsNull(Screen.ActiveControl) = False Then
'convert text to Proper Case
Screen.ActiveControl = StrConv(Screen.ActiveControl, vbUpperCase)
End If
End Sub
The set focus doesnt seem to work, please help me whats wrong with my coding..tnx
Why are you setting the focus?
If user selects No from the prompt Undo command will clear the form but my cursor is on the next field,
-
Private Sub SupplierSKUCode_AfterUpdate()
-
If Nz(DLookup("SupplierSKUCode", "tblProduct", "SupplierSKUCode='" & _
-
Me.SupplierSKUCode & "'"), "zzzz") <> "zzzz" Then MsgBox "SupplierSKUCode Already Exist.", vbCritical
-
-
If MsgBox("Duplicate Record." _
-
& vbCrLf & vbCrLf & "Do you want to have Duplicate Record?" _
-
, vbYesNo, "Changes Made...") = vbYes Then
-
Me.ProductDescription.SetFocus
-
Else
-
DoCmd.RunCommand acCmdUndo
-
Me.Requery ' if that doesn't work try Me.Refresh
-
Me.SupplierSKUCode.SetFocus
-
End If
-
-
'Test if control contains text
-
If IsNull(Screen.ActiveControl) = False Then
-
'convert text to Proper Case
-
Screen.ActiveControl = StrConv(Screen.ActiveControl, vbUpperCase)
-
End If
-
End Sub
-
-
Private Sub SupplierSKUCode_AfterUpdate()
-
If Nz(DLookup("SupplierSKUCode", "tblProduct", "SupplierSKUCode='" & _
-
Me.SupplierSKUCode & "'"), "zzzz") <> "zzzz" Then MsgBox "SupplierSKUCode Already Exist.", vbCritical
-
-
If MsgBox("Duplicate Record." _
-
& vbCrLf & vbCrLf & "Do you want to have Duplicate Record?" _
-
, vbYesNo, "Changes Made...") = vbYes Then
-
Me.ProductDescription.SetFocus
-
Else
-
DoCmd.RunCommand acCmdUndo
-
Me.Requery ' if that doesn't work try Me.Refresh
-
Me.SupplierSKUCode.SetFocus
-
End If
-
-
'Test if control contains text
-
If IsNull(Screen.ActiveControl) = False Then
-
'convert text to Proper Case
-
Screen.ActiveControl = StrConv(Screen.ActiveControl, vbUpperCase)
-
End If
-
End Sub
-
Me.Requery sets me back to the first record...Me.Refresh doesnt work at all, the focus gets to the next field...cant think of any otherwise...but really i appreciate your help...any more ideas will be valued...
-
Private Sub SupplierSKUCode_AfterUpdate()
-
If Nz(DLookup("SupplierSKUCode", "tblProduct", "SupplierSKUCode='" & _
-
Me.SupplierSKUCode & "'"), "zzzz") <> "zzzz" Then MsgBox "SupplierSKUCode Already Exist.", vbCritical
-
-
If MsgBox("Duplicate Record." _
-
& vbCrLf & vbCrLf & "Do you want to have Duplicate Record?" _
-
, vbYesNo, "Changes Made...") = vbYes Then
-
Me.ProductDescription.SetFocus
-
Else
-
DoCmd.RunCommand acCmdUndo
-
Me.ProductDescription.SetFocus
-
Me.SupplierSKUCode.SetFocus
-
End If
-
-
'Test if control contains text
-
If IsNull(Screen.ActiveControl) = False Then
-
'convert text to Proper Case
-
Screen.ActiveControl = StrConv(Screen.ActiveControl, vbUpperCase)
-
End If
-
End Sub
-
I had a bright idea, try this ... -
Private Sub SupplierSKUCode_AfterUpdate()
-
Dim ctlName As String
-
-
If Nz(DLookup("SupplierSKUCode", "tblProduct", "SupplierSKUCode='" & _
-
Me.SupplierSKUCode & "'"), "zzzz") <> "zzzz" Then MsgBox "SupplierSKUCode Already Exist.", vbCritical
-
-
If MsgBox("Duplicate Record." _
-
& vbCrLf & vbCrLf & "Do you want to have Duplicate Record?" _
-
, vbYesNo, "Changes Made...") = vbYes Then
-
ctlName = "ProductDescription"
-
Else
-
DoCmd.RunCommand acCmdUndo
-
ctlName = "SupplierSKUCode"
-
End If
-
-
'Test if control contains text
-
If Not IsNull(Me(ctlName)) Then
-
'convert text to Proper Case
-
Me(ctlName) = StrConv(Me(ctlName), vbUpperCase)
-
End If
-
End Sub
-
i tried setting the focus to other field...it worked after the undo command..i just dont get it...SupplierSkuCode is properly spelled but it wont set focus after all.
Im really glad THESCRIPTS exist...u guys are great!
i tried setting the focus to other field...it worked after the undo command..i just dont get it...SupplierSkuCode is properly spelled but it wont set focus after all.
Im really glad THESCRIPTS exist...u guys are great!
You're welcome. Did you try my last suggestion?
Hooray!!!!this code worked! Thanks very much!God Bless and More power!
Private Sub SupplierSKUCode_AfterUpdate()
If Nz(DLookup("SupplierSKUCode", "tblProduct", "SupplierSKUCode='" & _
Me.SupplierSKUCode & "'"), "zzzz") <> "zzzz" Then MsgBox "SupplierSKUCode Already Exist.", vbCritical
If MsgBox("Duplicate Record." _
& vbCrLf & vbCrLf & "Do you want to have Duplicate Record?" _
, vbYesNo, "Changes Made...") = vbYes Then
Me.ProductDescription.SetFocus
Else
DoCmd.RunCommand acCmdUndo
Me.ProductDescription.SetFocus
Me.SupplierSKUCode.SetFocus
End If
'Test if control contains text
If IsNull(Screen.ActiveControl) = False Then
'convert text to Proper Case
Screen.ActiveControl = StrConv(Screen.ActiveControl, vbUpperCase)
End If
End Sub
hi mary or anybody in here,
is it possible that the duplicate record message box wont appear if the SKU code doesnt exist...it bothers me coz everytime i have a new record the second "If" appears ask me vbyesno...ty
Private Sub SupplierSKUCode_AfterUpdate()
If Nz(DLookup("SupplierSKUCode", "tblProduct", "SupplierSKUCode='" & _
Me.SupplierSKUCode & "'"), "zzzz") <> "zzzz" Then MsgBox "SupplierSKUCode Already Exist.", vbCritical
If MsgBox("Duplicate Record." _
& vbCrLf & vbCrLf & "Do you want to have Duplicate Record?" _
, vbYesNo, "Changes Made...") = vbYes Then
Me.ProductDescription.SetFocus
Else
DoCmd.RunCommand acCmdUndo
Me.ProductDescription.SetFocus
Me.SupplierSKUCode.SetFocus
End If
'Test if control contains text
If IsNull(Screen.ActiveControl) = False Then
'convert text to Proper Case
Screen.ActiveControl = StrConv(Screen.ActiveControl, vbUpperCase)
End If
End Sub[/quote]
Sign in to post your reply or Sign up for a free account.
Similar topics
by: amy |
last post by:
I have a text box, after user input the value, a validate function
trigered. if the value is invalid, alert display, and also set focus
back to this control.
The alert displays, but when the...
|
by: Mad Scientist Jr |
last post by:
i am trying to set focus to a specific control depending on the
outcome of a validator control and it is not working.
none of these methods are working to setfocus:
1....
|
by: Shachar |
last post by:
Hi All,
I need to start a new process calc for example and when ever the user click
on the button the
application should setfocus to the calc application.
I use this code but it is NOT...
|
by: Gil |
last post by:
can you set focus to the current access application through vba?
lets say i tell access to open another application and that new
application gains the focus and causes access to loose the focus....
|
by: agroover |
last post by:
I can't seem to figure out how to get rid of the errors.
I recieve the following error when I leave the Grade.SetFocus in my code...
Microsoft Access can't move the focus to the control Grade
...
|
by: Hong |
last post by:
Hi
I have a main form with 7 subforms where the master/child link is the RefID in the main form where the Main form is 1-many relationship to those subforms. All the subform have the same...
|
by: rockdc1981 |
last post by:
please help me with my code, any revisions is appreciated...
Private Sub Combo42_LostFocus()
Dim Result
Dim Msg
Dim cr As String
cr = Chr$(13)
Result = Me.Combo42
If IsNull(Result)...
|
by: OldBirdman |
last post by:
This should be so, so simple I hesitate to ask.
I have a Form named "fNavButtons" used as a SubForm in control named "subformNavButtons". subformNavButtons is a control on my main form named...
|
by: ckrows |
last post by:
I have a main form with a button that makes a subform visible.
I added a button in the form footer of the subform that is supposed to hide the subform. This does not work because the focus is on...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |