A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

OpenForm WhereCondition=Variable



 
 
Thread Tools Display Modes
  #1  
Old February 23rd, 2006, 08:57 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default OpenForm WhereCondition=Variable

Can someone tell me how to open a form to show only records defined by a
variable? My code works if I type a literal number in but I can't figure out
how do it with a variable:
Dim stDocName As String
Dim stLinkCriteria As String
Dim MyVariable As Long

txtECRNumber.SetFocus
MyVariable = txtECRNumber.Text
stDocName = "subfECRTasks"

DoCmd.OpenForm stDocName, , , "ECRNumber = MyVariable"
  #2  
Old February 23rd, 2006, 09:02 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default OpenForm WhereCondition=Variable

DoCmd.OpenForm stDocName, , , "ECRNumber =" & MyVariable

Brian

"Dave Hoder" wrote in message
...
Can someone tell me how to open a form to show only records defined by a
variable? My code works if I type a literal number in but I can't figure

out
how do it with a variable:
Dim stDocName As String
Dim stLinkCriteria As String
Dim MyVariable As Long

txtECRNumber.SetFocus
MyVariable = txtECRNumber.Text
stDocName = "subfECRTasks"

DoCmd.OpenForm stDocName, , , "ECRNumber = MyVariable"



  #3  
Old February 23rd, 2006, 09:27 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default OpenForm WhereCondition=Variable

Thank You Brian!

"Brian Bastl" wrote:

DoCmd.OpenForm stDocName, , , "ECRNumber =" & MyVariable


Brian

"Dave Hoder" wrote in message
...
Can someone tell me how to open a form to show only records defined by a
variable? My code works if I type a literal number in but I can't figure

out
how do it with a variable:
Dim stDocName As String
Dim stLinkCriteria As String
Dim MyVariable As Long

txtECRNumber.SetFocus
MyVariable = txtECRNumber.Text
stDocName = "subfECRTasks"

DoCmd.OpenForm stDocName, , , "ECRNumber = MyVariable"




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Openform with Wherecondition causes Parameter entry request Ace9x Using Forms 1 September 28th, 2005 07:38 PM
"The OpenForm action was canceled" John Phelan-Cummings via AccessMonster.com Using Forms 3 August 4th, 2005 03:04 PM
OpenForm Action Cancelled Jan Il Using Forms 10 November 29th, 2004 04:17 AM
2003 OpenForm, Magnified and in Larger Window Jim Shores Setting Up & Running Reports 0 July 7th, 2004 11:07 PM
OpenForm command Dan Cole New Users 2 May 18th, 2004 10:24 PM


All times are GMT +1. The time now is 04:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.