473,569 Members | 2,879 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem opening form with selection

Really wierd problem opening a form with selection.

I use this code on a button:

On Error GoTo Err_Command8_Cl ick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_ADv5"

If Forms!frm_ADv5_ List!keyADv5 <0 Then
stLinkCriteria = "((keyADv5 = " & Me.keyADv5 & "))"

DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
End If

Exit_Command8_C lick:

I know the code is going through the first part of the IF condition.

The stLinkCriteria = ((keyADv5 = 14))

When I click on the icon, it opens up the form, but a blank form. The
filter icon is highlighted. If I mouse over, it says "Remove FIlter".
If I click on it, then form then displays the proper filtered record.

I checked in Design mode the form, after it was opened,and it has Allow
Filters = YES and Filter = ((keyADv5 = 14))

This is wierd. I have used similar code before without any problems.

What am I missing? Hopefully something simple.

Bob
Jul 23 '06 #1
1 1740
Try this

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_ADv5"

Me.keyADv5.SetF ocus

If Me.KeyADv5<>0 Then
stLinkCriteria = "[keyADv5]=" & Me.keyADv5
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
DoCmd.OpenForm stDocName, , , , acFormAdd
End If

Jul 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1616
by: Francisco Mendez | last post by:
I have the following problem: When i use "scooters" in the value of the radio as well as in the switch statement, the code doesn't get executed, but if i use "scooter" it does. Is there something wrong with my code? Thanks FM> -------------------------- Code is as follows:
2
4015
by: Kingdom | last post by:
I have a SelectBoxes.asp page that is working with multiple selection dropdown boxes to extract data and total the selection prices. Tom & Bob were kind enough to give me a big help getting this page working and it's working just fine, no problems with this page. However I then would like this data e-mailed using jmail (my host insists on...
2
11207
by: Mark Szlazak | last post by:
The following code fails in Firefox to get at selected text in the right-side textarea. Any help would be appreciated. <html> <head> <script> var agt = navigator.userAgent.toLowerCase(); var safari = ((agt.indexOf('safari') != -1) && (agt.indexOf('mac') != -1))? true:false; var opera = (window.opera)? true:false;
1
1711
by: Filips Benoit | last post by:
Dear All, Selecting 1 order in a listbox by code. Works OK, BUT Opening a related form using Me.LstOrders.Column(0) as criteriavalue sometimes triggers an error: 'There was a problem accessing a property or methode of the OLE object' MsgBox Me.LstOrders.ItemsSelected.Count MsgBox "= " & Me.LstOrders.Column(0)
5
3304
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the main form is reactivated following opening and closing a modal form. Strangely, this was not a problem until I started using my Access 2000 db in...
3
1748
by: yup | last post by:
I was wondering if you know a way to have, let's say, you would click on a menu bar item (where something like file, edit, format, help options are on Microsoft Word) and instead of opening a dialog box it would "switch" to another page (within the program) and maintain the same menu bar as before. For example, in Quicken I would click on...
4
7129
by: MrL8Knight | last post by:
Hello, I am trying to build a simple php form based shopping cart using a cookie with arrays. I need to use 1 cookie because each order will have over 20 items. With that said, I realize I need to serialize the data to put the array into the cookie. That part of my code is working just fine and displaying fine. The problem I’m having is when I...
2
3360
by: BerkshireGuy | last post by:
I want to open a word document from an Access form and transfer data from the Access form to the Word Document. For instance, if a user clicks an option box on my access form, I want to pass certain data to the next new line of a opened word doc. Here is what I tried, but doesnt seem to work: Dim objWord As Object Dim NewRow As Row
1
1897
by: emmaruwa | last post by:
I have a form with two text boxes (in its details section) that pull data from two fields in my database table. This same form also has a button beside the text boxes which is supposed to open another form and populate that form with a record from the table using the data in the previous two text boxes as record selection criteria. However, it...
0
7619
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7930
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7681
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.