Open Form

Petros

Registered User.
Local time
Today, 21:04
Joined
Jun 30, 2010
Messages
145
Hi again, i am using below code to open a form with related record. However, the form opens but prompts for a new record.. why is it that? Access 2007 frontend / SQL 2008 backend.
ID is the primary key
Fruits is the form i want to open

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Fruits"
stLinkCriteria = "[ID]=" & "'" & Me![ID] & "'"
DoCmd.OpenForm stDocName, , , "[Fruits]" = " & Me.ID"
Thanks!
 
You have misplaced quotes:
DoCmd.OpenForm stDocName, , , "[Fruits]" = " & Me.ID"

Get rid of the quote at the end of Fruits and the last one.

It should be:
DoCmd.OpenForm stDocName, , , "[Fruits] = " & Me.ID
 
Thanks you BobLarsson..as always.. :)

Unfortunately this do not cure the issue were the related form opens and prompts for a new record (New)...
 
Thanks you BobLarsson..as always.. :)

Unfortunately this do not cure the issue were the related form opens and prompts for a new record (New)...

Make sure the related form doesn't have its DATA ENTRY property set to YES. It should be NO if you want to be able to go to a specific record.
 
Nope..i will try to figure this one out in one way or other..must be related to the SQL..Thanks anyways!
 

Users who are viewing this thread

Back
Top Bottom