Change:
stLinkCriteria = "TripNo= & [TripNo] " '"
with
stLinkCriteria = "TripNo= '" & [TripNo] & "'" if TripNo is string else
stLinkCriteria = "TripNo= " & [TripNo]
Ciao Domenico
Il giorno lun 20 gen 2020 alle ore 08:50 Khalid Tanweer via Groups.Io <khalidtanweerburrah=yahoo.com@groups.io> ha scritto:
Hi all,
I'm working on a form "Add New Cst". On its field Name "TripNo" and Control source is "TripNo" Format Standard, decimal places = 0
On its BeforeUpdateEvent I'm getting a Run time error '3075;
Syntax error (missing operator) in query expression 'TripNo= &
[TripNo]';
I want this message not comes and it should check for Duplicate entry, Event is:
Private Sub TripNo_BeforeUpdate(Cancel As Integer)Dim stLinkCriteria As StringDim rsc As DAO.Recordset'Don 't check if not on a new row'If Not Me.NewRecord Then Exit SubstLinkCriteria = "TripNo= & [TripNo] " '"Debug.Print stLinkCriteria'Check Cst table for duplicate TripNoIf DCount("*", TripNo, stLinkCriteria) > 0 Then'Message box warning of duplicationMsgBox "This Trip No: " & [TripNo] & " has already been entered" & vbCrLf & _"at" & [TripNo] & "." _, vbInformation, "Duplicate Entry"'Undo duplicate entryMe.Undo'Go to record of original TripNoSet rsc = Me.RecordsetClonersc.FindFirst stLinkCriteriaMe.Bookmark = rsc.BookmarkSet rsc = NothingEnd IfEnd Sub-----------
Please help where is the mistake.
Thanks Khalid
_._,_._,_
Groups.io Links:
You receive all messages sent to this group.
View/Reply Online (#115409) | Reply To Group | Reply To Sender | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [sugeng.panjalu.access@blogger.com]
_._,_._,_
Tidak ada komentar:
Posting Komentar