Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-15-2019, 08:37 PM   #16
June7
AWF VIP
 
June7's Avatar
 
Join Date: Mar 2014
Location: The Great Land
Posts: 2,272
Thanks: 0
Thanked 533 Times in 529 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: Help with Dlookup with 3 criteria

Let me ask again.

User enters data into subfrm_Verified and you want to run DLookup to see if there is a match in Query3?

I just discovered that RefNos in that query is just a formatted version of SrNo which is a calculated value returned by a function. I think something you said earlier just sunk in. This is why RefNos in Table3 has no values.

Okay, if you want to do DLookup on query, then modify DLookup to reference the query instead of table.

Put code in form BeforeUpdate event.
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("OutwardDate", "Query3", "RefNos='" & Me.Ref_Nos & "' AND BranchName='" & Me.Branch_Name & "' AND AccountNos='" & Me.Account_Nos & "'")) Then
    Me.Status = "Match"
Else
    Cancel = True
    MsgBox "No Match"
    Me.Undo
    Me.Date_Checked.SetFocus
End If
End Sub

__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by June7; 09-15-2019 at 11:18 PM.
June7 is offline   Reply With Quote
Old 09-15-2019, 11:12 PM   #17
lookforsmt
Newly Registered User
 
Join Date: Dec 2011
Posts: 514
Thanks: 74
Thanked 2 Times in 2 Posts
lookforsmt is on a distinguished road
Re: Help with Dlookup with 3 criteria

Thanks June7, can you assist me pls
lookforsmt is offline   Reply With Quote
Old 09-15-2019, 11:31 PM   #18
June7
AWF VIP
 
June7's Avatar
 
Join Date: Mar 2014
Location: The Great Land
Posts: 2,272
Thanks: 0
Thanked 533 Times in 529 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: Help with Dlookup with 3 criteria

Looks like I edited my post after you posted yours. Read again.

__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
Old 09-15-2019, 11:59 PM   #19
lookforsmt
Newly Registered User
 
Join Date: Dec 2011
Posts: 514
Thanks: 74
Thanked 2 Times in 2 Posts
lookforsmt is on a distinguished road
Re: Help with Dlookup with 3 criteria

Thanks June, yes I did not see your post after edit.
Will check and update you shortly
lookforsmt is offline   Reply With Quote
Old 09-16-2019, 11:40 AM   #20
lookforsmt
Newly Registered User
 
Join Date: Dec 2011
Posts: 514
Thanks: 74
Thanked 2 Times in 2 Posts
lookforsmt is on a distinguished road
Re: Help with Dlookup with 3 criteria

Thank you June7 for the time and the code. this is what i wanted. works perfectly. i was struggling to find the code for long time.

Thank you once again for your support

lookforsmt is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DLookUp as criteria within DLookup chuckcoleman Modules & VBA 15 04-10-2019 11:39 AM
DLookup without criteria? MangoFruit Forms 3 03-23-2014 04:55 AM
Dlookup with a between criteria cablegirl Queries 4 08-07-2013 06:32 PM
Dlookup criteria melika Modules & VBA 2 11-08-2007 10:37 AM
DLookup with 2 criteria. hooi General 5 10-22-2003 01:01 AM




All times are GMT -8. The time now is 02:13 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World