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

After Update event asking for paramater value

I have a form called f_Dashboard which has the following code on the AfterUpdate() event of an unbound field called SelectCityAllTrips. This code opens a filtered set of records in f_MainTripForm based on the value that the user enters in the SelectCityAllTrips field.

Expand|Select|Wrap|Line Numbers
  1. Private Sub SelectCityAllTrips_AfterUpdate()
  2. DoCmd.OpenForm "f_MainTripForm", , , "City = " & SelectCityAllTrips.value
  3. DoCmd.Close acForm, "f_Dashboard"
  4. End Sub
When the code runs, it opens an input form asking the user to enter a parameter value. See image

When you re-type the value here again, f_MainTripForm opens up with the correct records.

I am trying to bypass the parameter request and open the form directly.

I have several other unbound fields that work with similar code but they don't ask for a parameter value to be re-entered. The only difference is that the other fields use numberic values and this is a text field.

Any help appreciated.
Sandra

Attached Images
File Type: png example.png (15.4 KB, 300 views)
May 29 '12 #1

✓ answered by Rabbit

That's because string values need to be enclosed in quotes.
Expand|Select|Wrap|Line Numbers
  1. WHERE city = 'Chicago'
  2. WHERE city = Chicago
The first one if what you need. The second one is what you have.

3 1903
Rabbit
12,516 Expert Mod 8TB
That's because string values need to be enclosed in quotes.
Expand|Select|Wrap|Line Numbers
  1. WHERE city = 'Chicago'
  2. WHERE city = Chicago
The first one if what you need. The second one is what you have.
May 29 '12 #2
Thanks for the clue!

Here is the updated code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub SelectCityAllTrips_AfterUpdate()
  2.  
  3. DoCmd.OpenForm "f_MainTripForm", , , "City = " & "'" & SelectCityAllTrips.value & "'"
  4. DoCmd.Close acForm, "f_Dashboard"
  5. End Sub
  6.  
Much appreciated!
May 29 '12 #3
NeoPa
32,556 Expert Mod 16PB
Indeed. See Quotes (') and Double-Quotes (") - Where and When to use them.

Also, you don't need to concatenate (&) two separate literal strings on a single line. "City = " & "'" is no different from "City = '". Your code could be :
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "f_MainTripForm", , , "[City] = '" & SelectCityAllTrips & "'"
Jun 2 '12 #4

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

Similar topics

3
by: David | last post by:
Hi I use a calendar to update a field and the after update event no longer works, if i manually update it there is not a problem. How can I get this event to trigger Thanks in advance Dave
6
by: Dugo | last post by:
I'm trying to use a "keypad" form (with command buttons for numbers 0 thru 9) I developed to allow users to first click a textbox on one form, then click a number on the keypad and have the value...
3
by: visionstate | last post by:
Hi All, I have put the following code in the 'After Update' of a combo box: Private Sub ComboTeam_AfterUpdate() lblSurnameNotify.Visible = True Me!ComboSurname = Null Me!ComboSurname.Requery...
1
by: Dave | last post by:
I'm having problems with certain fields that I force an update (Me.dirty=false) in the After Update Event I lose focus of the field where the user was or where he clicked help Is there a way...
4
by: Mikep99 | last post by:
I am new to access and need some help with coding. I have a main form XYZ with 2 subforms. I have a checkbox on subform1 "frmExpediteS" that when checked i would like the Value in Feild "PO" of this...
4
by: injanib via AccessMonster.com | last post by:
I have a combo box called "Recipient" who's row source is a table called "Main" with three columns. The three columns are "Name", "Floor", "Location". Following the combo box are two fields called...
26
kcdoell
by: kcdoell | last post by:
Hello: I have a continuous form that displays records. In the AfterUpdate event of one of the fields, Binding_Percentage, I have the following code: Private Sub...
5
by: Zeeshan7 | last post by:
After Update Event Procedure on a form is not working after upsizing database to SQL server. Anything to add in below code as it generate run time error 3622 "You must use the dbSeeChanges option...
14
Rozeanna Jerry
by: Rozeanna Jerry | last post by:
Hi Experts, am new to access. I juts created a form with sub form based on two tables having 1: many relationship. The main form is from tblStudents and subform is from tble attendance. First...
1
by: ncsthbell | last post by:
Hello, I hope I can do a good enough job trying to explain this situation! I have inherited the maintenance for an access database and I have been requested to make a change to a form to add 2...
0
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,...
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:
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...
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
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
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...

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.