473,396 Members | 1,846 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,396 software developers and data experts.

Query By Form without Drop Down

Experts: I have an unbound text box that has an AfterUpdate which opens the Order Form for the specific Order # (Unique ID) that was entered. Only problem is that when they enter a number that is not valid (not in the table) it still opens the form and shows a blank record. I would like it to recognize that the number is not valild, show a warning message, and not open the form.

I used to have drop-downs linked to the table's Unique ID's but we have too many records and too many users always refreshing the data so the drop downs are not an option. Here is the code I'm currently using:
Expand|Select|Wrap|Line Numbers
  1. Private Sub uniqueacct_AfterUpdate()
  2. If Me![uniqueacct] >= 0 Then DoCmd.OpenForm "frm-accounting", , , "[Unique ID] = " & Me![uniqueacct]
  3. [Forms]![search]![uniqueacct] = ""
  4. End Sub
  5.  

Thanks for any help!!
Oct 24 '07 #1
4 1238
Rabbit
12,516 Expert Mod 8TB
Please use code tags.

What you can do it use the DCount() function to see how many records match that ID number.
Oct 24 '07 #2
nico5038
3,080 Expert 2GB
Why not change the textbox into a combobox with a "Select Distinct [Unique ID] from tblOrders" as recordsource?
Thus only existing values can be chosen and the autoappend might save some typing...

Nic;o)
Oct 24 '07 #3
Rabbit
12,516 Expert Mod 8TB
Why not change the textbox into a combobox with a "Select Distinct [Unique ID] from tblOrders" as recordsource?
Thus only existing values can be chosen and the autoappend might save some typing...

Nic;o)
I don't think the problem was duplicate records but the volume of the records.
Oct 25 '07 #4
nico5038
3,080 Expert 2GB
Hi Rabbit, the "Distinct" is only added for "just in case" there are multiple ID's. The main idea is the fact that the user can only select ID's that are found in the table :-)
Saves the testing for an empty recordset.....

Nic;o)
Oct 25 '07 #5

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

Similar topics

1
by: Gx | last post by:
I have this form with the fields: * Product: (drop down combo box) with choices - X, Y * Amount: (currency ) * Balance (currency) I want to associate product X with the percentage...
1
by: Robert Neville | last post by:
The solution to my dilemma seems straight-forward, yet my mind has not been forthcoming with a direct route. My Project form has a tab control with multiple sub-forms; these distinct sub-forms...
3
by: cassandra.flowers | last post by:
Hi, I was wondering if it is possible (Using access) to have a query parameter as a drop down box rather than a text box? e.g. typing as criteria for a query produces a box with a text box...
3
by: Erwin Bormans | last post by:
Hello I want to make a parameter query where i can select the parameter out of a drop down box instead of typing the parameter in a text box. For example: if i have customers and want to run a...
2
by: doctorfeelyg | last post by:
Hi there, I’m relatively new to access so please forgive any ignorance. Here is my, rather long-winded, plea for help: I have a main table which contains a list of ‘projects’ and associated...
6
by: nbomike | last post by:
I am trying to integrate a custom page into a shopping cart app written in PHP. The custom page is basically a part finder widget that helps customers find a car part based on the car's make, model,...
4
Sandboxer
by: Sandboxer | last post by:
I want to be able to program Access to provide for me, by individual day, what my contract obligations are to my customers. Will Access recognize all the individual days in between a date range...
4
kcdoell
by: kcdoell | last post by:
Hello: What is the best way to stop a report from running if the query is empty? Currently, I have a form that has a command button on it. The user has to make selections from 3 combo boxes on...
7
by: kpouya | last post by:
Anyone could tell me how i could have a form, that runs a query and returns the result in a report form? it seems simple but i can't get it to work. so basically the criteria for the form should...
26
by: kpouya | last post by:
I am going to be as clear as possible about what i got right now and what i want to achieve Table1: Libary Title - memo Last Name - memo First Name - memo Company - memo Year - number Type -...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
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,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.