Access 2007 button code

M

mans

First post on here. i found a similar post to this but could not get it to work for me. im not very experienced with access.

The proble

I have a continuous form with limited data and I would like to have a butto
which then opens up a selected record in another form I've placed the butto
via the wizard and, while it opens the form, it doesn't open to the selecte
record

It it possible to have a button on a continous form which would then ope
to a bookmarked record on another form? The wizard put this code, is i
possible to modify this

Private Sub Command48_Click(
On Error GoTo Err_Command48_Clic
Dim stDocName As Strin
Dim stLinkCriteria As Strin
stDocName = "frmMoreInfo

End Su

Thanks
 
A

Albert D. Kallal

Private Sub Command48_Click()
On Error GoTo Err_Command48_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMoreInfo"

End Sub

The above code does not look correct.


The code you need is:
docmd.OpenForm "frmDetails",,,"id = " & me!id


So, you only need the above one line of code....
 
M

mans

the code i posted was just from the wizard and worked but did not take me to the specific record in other form, it just opens on first record on that form. i hadn't made any changes to it.

i tried this but does the same thing does not take me the the specific recor
Private Sub Command48_Click(
DoCmd.OpenForm "frmDetails", , , "id = " & Me!i

End Su

?
 
M

mans

name of my button is: Command4
name of form which button is in is: Student
name of the field that im using to find th
matching record on the second form is: Student I
 
M

mans

its ok sorted heres the code i used

Private Sub Command51_Click()
On Error GoTo Command51_Click_Err
Dim strWhere As String

'for a number type [ID]
strWhere = "[Student ID] = " & Me.[Student ID]



DoCmd.OpenForm "Add Student to Child University", , , strWhere


Command51_Click_Exit:
Exit Sub

Command51_Click_Err:
MsgBox Error$
Resume Command51_Click_Exit

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top