473,387 Members | 1,569 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.

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_Click

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_Click:

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 1720
Try this

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_ADv5"

Me.keyADv5.SetFocus

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
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...
2
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...
2
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();...
1
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...
5
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...
3
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...
4
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...
2
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...
1
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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
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
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.