Access/VBA Conditional Statement



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





*** Sent via Developersdex http://www.developersdex.com ***
.



Relevant Pages

  • Re: ADO - Strange Behaviour
    ... > that is working via a third, linking, table. ... My main data entry form is based on a query as there ... > - InspectorID, Category, ReportID ...
    (microsoft.public.access.modulesdaovba)
  • Re: Multiple Tables
    ... I was able to link it through subforms by linking the name and the date on ... able to keep the subform format. ... > BCBS OF ... >> the query, but I don't know what the query IS because I cannot see it. ...
    (microsoft.public.access.tablesdbdesign)
  • recreating an autonumber field
    ... I currently do this so i can link a table with a query that contains the ... same values only one record lower relative to the autonumber. ... recreate the autonumber is because records get added/deleted. ... Or is there a different method of linking or looking up the previous record ...
    (microsoft.public.access.formscoding)
  • ADO - Strange Behaviour
    ... that is working via a third, linking, table. ... My main data entry form is based on a query as there ... The query that populates the sub-form in Point 3 uses the ... ReportID, which is contained in the main data entry form, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Access/VBA Conditional Statement
    ... The extra quotes are text delimiters. ... but the problem is when i try to create a query it wont work with the 2 ... but not for linking the 2 tables. ... DoCmd.OpenForm stDocName,,, stLinkCriteria ...
    (comp.databases.ms-access)