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 / General 1 / April 2006

Tip: Looking for answers? Try searching our database.

Access/VBA Conditional Statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
davy d - 29 Apr 2006 18:53 GMT
I'm having a problem with an acess form linkin with another form.
My index in the main form is Autonumber (Rec#)
the 2nd form  is called Record# and it is set for text.
The link criteria works well with linking these 2 forms together with
these conditiosn, here is the vb code:  stLinkCriteria = "[Rec#]=" & "'"
& Me![Record#] & "'"

but the problem is when i try to create a query it wont work with the 2
tables since they arte mismatched.
numeric to text, switching the field to numeric is great for the query
but not for linking the 2 tables.
i tried this but it doesnt work: If DCount("*","Rec#","[Rec#] = " &
Me!Record# ") > 0
can anyone help with this VBcode? here is the entire piece:

   stDocName = "Home"
   stLinkCriteria = "[Rec#]=" & "'" & Me![Record#] & "'"
   DoCmd.OpenForm stDocName, , , stLinkCriteria
Wayne Morgan - 29 Apr 2006 23:09 GMT
If you change the data type to a number, you don't need the extra quotes in
the code. The extra quotes are text delimiters.

Example:
stLinkCriteria = "[Rec#]=" & Me.[Record#]

You shouldn't store numbers as text without a good reason to do so if the
number is actually to be used as a numeric value (i.e. not a phone number,
zip code, SSN, etc).

Signature

Wayne Morgan
MS Access MVP

> I'm having a problem with an acess form linkin with another form.
> My index in the main form is Autonumber (Rec#)
[quoted text clipped - 16 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***
 
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.