please help new access user

  • Thread starter Thread starter reservedbcreater
  • Start date Start date
R

reservedbcreater

im totally new to access, my 8 month project at work is to create a access
db. anyway i want the first form to close and open a new form when next is
clicked. i did that. but i also want the new form to open with the same ID
field as the first form. this is what i have now and it doesn't work:

Dim stDocName As String
Dim stLinkCriteria As String


stLinkCriteria = "ID=" & Me.ID

DoCmd.Close

stDocName = "Water: Sweet Grass"
DoCmd.OpenForm stDocName, , , stLinkCriteria
 
there are 17 forms all following each other(its a survey), each form has an
ID field. all forms open as soon as next is clicked. everytime its clicked
i want the next form to open with ID field the same as previous......so
that once u fill out all 17 forms, they all have the same ID field.

Also if possible, i want the first form to open at the first unused ID
#???????????
 
hi,
not sure but you may have a sequence problem.
open the 2nd form before closing the 1st form.
try somthing like this

Private Sub cmdgo_Click()
Dim stLinkCriteria As String

stLinkCriteria = Me![CustID]

DoCmd.OpenForm "frmtest2", acNormal, , , acFormEdit
[Forms]![2ndform]![txtbox1] = stLinkCriteria
DoCmd.Close acForm, Me.Name, acSaveYes '1stform

End Sub

tested. works. (as least on tuesdays)
 
reservedbcreater said:
im totally new to access, my 8 month project at work is to create a access
db. anyway i want the first form to close and open a new form when next is
clicked. i did that. but i also want the new form to open with the same ID
field as the first form. this is what i have now and it doesn't work:

Dim stDocName As String
Dim stLinkCriteria As String


stLinkCriteria = "ID=" & Me.ID

DoCmd.Close

stDocName = "Water: Sweet Grass"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Something like this in your next button's click event

Dim strDocName As String
Dim strID As String
strDocName = "Water: Sweet Grass"
strID = Me.ID
DoCmd.Close
DoCmd.Openform strDocName
Forms(strDocName)!IDFieldName = strID

HTH
Steve C
 

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

Back
Top