Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2005

Tip: Looking for answers? Try searching our database.

open form criteria, text not numeric

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
r - 25 Jul 2005 22:45 GMT
A step in my macro is to open a form where the record in the new form will
match the value selected on the first form's dropdown box.  The IDs,
unfortunately, are text and not numeric, so I'm having trouble finding the
right record in the set.

my "where" is:

[customerID] = [forms]![details]![customerID]

but despite my variations in writing this, I get either a type mismatch, or
a new record comes up (though I can see the filter has been applied).

The dropdown box I'm using to select the customerID on the first form does
not
have a control source, though I'm certain it's bound to the correct value
(the ID)
and not the customer name, which is the only other field displayed.

I'm guessing this is just a problem because the equation thinks i'm looking
for a numeric value, but I'm not sure how to put quotes, or whatever, to
indicated the value is text.

Help?!
Ofer - 25 Jul 2005 23:22 GMT
Try this for string
"[customerID] = '" & [forms]![details]![customerID] & "'"

For Number
"[customerID] = " & [forms]![details]![customerID]

For Date
"[DateField] = #" & [forms]![details]![DateField] & "#"

> A step in my macro is to open a form where the record in the new form will
> match the value selected on the first form's dropdown box.  The IDs,
[quoted text clipped - 19 lines]
>
> Help?!
r - 26 Jul 2005 00:01 GMT
Thanks.  Unfortunately, the one for string did not work.  The "where"
statement is part of the OpenForm "Where" criteria in a macro, if that
helps.

> Try this for string
> "[customerID] = '" & [forms]![details]![customerID] & "'"
[quoted text clipped - 28 lines]
> >
> > Help?!
John Vinson - 26 Jul 2005 00:29 GMT
>A step in my macro is to open a form where the record in the new form will
>match the value selected on the first form's dropdown box.  The IDs,
[quoted text clipped - 4 lines]
>
>[customerID] = [forms]![details]![customerID]

Try putting in the syntactically required quotemarks:

Dim strWhere As String
strWhere = "[CustomerID] = '" & Forms!Details!CustomerID & "'"
DoCmd.OpenForm strWhere

                 John W. Vinson[MVP]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.