continuous form wont link (1 Viewer)

tubar

Registered User.
Local time
Today, 08:04
Joined
Jul 13, 2006
Messages
190
I have a continuous form that wont open another form with the onclick expression when there is criteria.
Code:
stDocName = "frmITEMSEARCH"
    stLinkCriteria = "[ID]=" & Me![id]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

is there a setting i am missing?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:04
Joined
May 7, 2009
Messages
19,246
go to debug mode and see if you can fix it.
 

Ranman256

Well-known member
Local time
Today, 09:04
Joined
Apr 9, 2015
Messages
4,337
the command is correct, so either:
the text box called ID is not named this
or
the ID is not filled in the textbox. (or connected to the field)

(you dont need the ME, me.ID)
DoCmd.OpenForm "frmITEMSEARCH", , , "[ID]=" & ID

(i ALWAYS label my text boxs with txt to distinguish fields from textboxs)
"[id]=" & txtID
 

tubar

Registered User.
Local time
Today, 08:04
Joined
Jul 13, 2006
Messages
190
thanks for the tip on the textbox naming... iw ill follow that from now on. when i click the third record in the continuous form i notice the id in the first record is highlighted. when the next form opens it pulls the record from that id. is there something i could add in my code to activate the id in the record i slect. sorry if that doesnt make sense
 

tubar

Registered User.
Local time
Today, 08:04
Joined
Jul 13, 2006
Messages
190
when i click on a record in continuous form its taking the id from the first record to link to the form i open. so i tried this code
Code:
Private Sub Image15_Click()
myrecnum = Me.CurrentRecord
ID.Requery
 DoCmd.GoToRecord , , , myrecnum
 ID.SetFocus
 
stDocName = "frmITEM"
    
    stLinkCriteria = "[id]=" & Me![ID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
thinking it would take the id of the record i click. however, it just goes to the next id everytime i click a record. exaple i click record five id 1 is criteria i click record 20 id 2 is criteria i click record 60 and id 3 is criteria and so on
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:04
Joined
May 7, 2009
Messages
19,246
just remove those first 4 lines in your code.
 

tubar

Registered User.
Local time
Today, 08:04
Joined
Jul 13, 2006
Messages
190
as in what i had in my first post?
 

Users who are viewing this thread

Top Bottom