473,419 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Match two fields in a table against a combo box selection and a text box entry / 2 fields on a form.

4 Nibble
Hi All,

I have a table NonReworkableparts with 2 fields of interest , Program Number and PartNo.

On my form the idea is to select a program number from a combo box and when I type in a part number if it is in the table then it gives out a msgbox.

There will be multiple part numbers, that's why I need to make sure I match against the program also.

I've been playing with DLookup, but I've had no luck so far, this is my latest attempt.

If IsNull(DLookup("[PartNo]", "NonReworkableparts", "[PartNo] = '" & Me.Part_Number & "'")) _
& " AND [Program Number] = '" & Me.Combo87 & "'" Then


Appreciate any help you guys can give.

Best regards,

Mark
Oct 7 '22 #1
5 18598
isladogs
456 Expert Mod 256MB
It would help if you had said what happened when you tried that DLookup: Error? 2 missing parameters message?

Are the two fields number datatypes? If so, omit the single quotes

Expand|Select|Wrap|Line Numbers
  1.  If IsNull(DLookup("PartNo", "NonReworkableparts", "PartNo = " & Me.Part_Number & ")) & " AND "[Program Number] = " & Me.Combo87 & "" Then
However the Dlookup expression makes no sense to me. It is checking whether the value of the PartNo field is null when the same field is equal to a textbox value. So perhaps the expression should be
Expand|Select|Wrap|Line Numbers
  1.  If Nz(Me.Part_Number,"")="" AND "[Program Number] = " & Me.Combo87  Then
Oct 8 '22 #2
Davism4
4 Nibble
Thanks for answering. My original code gives me: Runtime error 13 Mismatch. It was some code I found that I was playing with.

Basically, what I am trying to do on my form:

1) Select a program from a combo box
2) Enter a part number in a text box

The textbox after update event :

If part number and program on form = part number and program in table then return a message, otherwise do nothing.
The part numbers are alphanumerical

Hope that makes it clearer what I am trying to do.

Thanks again for the help.
Oct 10 '22 #3
NeoPa
32,556 Expert Mod 16PB
Hi Mark.

Isladogs has already passed on some basic advice for you. Can you confirm what happened when you tried out their suggestions? It's very hard to progress a problem without such feedback. Extra explanations & clarifications are always good too, but without directing a response to existing suggestions you leave us in the dark to a large extent.
Oct 23 '22 #4
zmbd
5,501 Expert Mod 4TB
My two cents

Make it easy:

Two Cascading comboboxes (Link to tutorial) with the second control to either pull-up the part-number information by either drop-down selection, which would prevent one from even selecting a part that isn't part of the project, or by direct entry. If the part number lookup is done by direct entry, then use the NotInList event to popup a message to the user and reset the control.

Easy-peasy-lemon-squeezee.

-Z
Oct 23 '22 #5
NeoPa
32,556 Expert Mod 16PB
Hi Z.

Easy (-p-l-s) to say, but I suspect if everyone found such a job to be that easy then we wouldn't be answering such questions quite so often ;-)

@Mark.
Just know we have people here for whom it really is easy so you can be helped, even if you take some mis-steps along the way.
Oct 23 '22 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". ...
16
by: Adda | last post by:
If I cycle through the MdiChildActivate event of the parent form I can read text in a textbox on the child mdiform -- console.writeline(Me.ActiveMdiChild.Controls(1).Text) But if I have a sub...
10
by: lorirobn | last post by:
Hi, I have a form with several combo boxes, continuous form format, with record source a query off an Item Table. The fields are Category, Subcategory, and Color. I am displaying descriptions,...
1
by: andy | last post by:
I have three things, 1. a form with a combo box on it. 2. A lookup table with 2 fields, RMName and RMmrm. 3. A table with site information including an RM field and an MRM field. The combo box...
3
by: wideasleep | last post by:
I have a subform that's a continuous form. In it I have a combo box that fills a date field. It works great except for one thing. It fills in all the other date fields for each record and the combo...
2
tdw
by: tdw | last post by:
I have a form which, when originally created, was solely for the purpose of viewing an order, not editing it (there was a different form for that), so the Allow Edits property was set to "No". But...
2
by: ssmith147 | last post by:
Hi, I'm somewhat familiar with access and vb programming (I can read someone else's code, for the most part), but I'm still very green when it comes to creating solutions for my own needs. I'm...
5
by: Dan Tallent | last post by:
I have a scenerio when my forms are first opened that the user cannot modify the data. The fields are disabled to prevent them from modifying any of the data. If a user wishes to modify the...
1
by: lovejoynigel | last post by:
hie guys am struggling here i have a web page with a form that consist of a text area and selection. the text area i use it for characters to search for, the selection option i used it for tables in...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.