Records Problem bwtn Forms

Why not just use the Button Wizard?
 
You were already using the "where" argument -

DoCmd.OpenForm stDocName, , , stLinkCriteria

except that you never put anything into stLinkCriteria.


So add the following, imediately prior to the OpenForm -

stLinkCriteria = "[ASRecord #] = '" & Me.[ASRecord #] & "'"

If [ASRecord #] is numeric, ditch the single quotes -

stLinkCriteria = "[ASRecord #] = " & Me.[ASRecord #]
 
ASRecord # is an auto number/ numeric field

Here's my code on the button to go to the External form:
Private Sub Command63_Click()
On Error GoTo Err_Command63_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Accessibility Housing Unit- External Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria = "[ASRecord #] = " & Me.[ASRecord #]



Exit_Command63_Click:
Exit Sub

Now when I click the button it goes into the external form it just says [auto] in the field and I can't click forward or backward thru the records...:(
 
Duh Me...I cleaned up the code now it seems to be working..I'll keep you posted when I set up my other buttons...I think I've almost got it! Again, THANKS for all you help so far !!!

stDocName = "Accessibility Housing Unit- External Form"
stLinkCriteria = "[ASRecord #] = " & Me.[ASRecord #]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Accessibility Survey Form"
 
OKay whole new problem but related...:)

It works ! I can go to record #34 and then click the button to go to the next form
when I go to the next form and it is at #34 and then I go to the next form and it's on #34 working great.
BUT.... say I decide I want to check #35 or I wanted to move between records on this form previous or next record button don't work it goes to a new record but not to other records says "you can't go to the specified record You may be at the end of the record set" ...it's not linking to the other records...and even if I go back to the main form it still is locked on #34, I have to closeall and go to switchborad and go back in to be able to move between records on the main form...

these are the codes for the previous:
Private Sub Command60_Click()
On Error GoTo Err_Command60_Click

DoCmd.GoToRecord , , acPrevious

Exit_Command60_Click:
Exit Sub

and next buttons:
Private Sub Command59_Click()
On Error GoTo Err_Command59_Click

DoCmd.GoToRecord , , acNext

Exit_Command59_Click:
Exit Sub

How do I link it to the records so I can still move back or forward on what ever form I'm on ??
 
When you specify arguments in the WHERE clause of the OpenForm, you are basically setting a filter. To be able to navigate other records, you must remove the filter. Perhaps have a button that says "Select all records", or "Remove Form Criteria" ... Check out FilterOn in Access Help.
 
Hello, I would like to thank everyone who posted replies and suggestions with your help I got it to work and Yes; pdx_man, I was fooling with it yesterday and realized I just had to remove the filter in order to move between records...SO I guess I'm not that hopeless after all - but with all your help, I've learned SOOO much about access so far form you guys I just hope I can share the wealth some day~
So Thanks again All! :D
 
That's what it's all about. Happy to help!
 

Users who are viewing this thread

Back
Top Bottom