help: button click event to open form to certain record

  • Thread starter reservedbcreater
  • Start date
R

reservedbcreater

ok..... i have 2 versions of the same forms...
1 is for adding surveys into the db.

one is for editing....

the one for adding is fine - it auto assigns an ID# then whenever u go to
the next form of the surevy its takes the value from previous form and
puts it in currnet forms ID# field....

this is fine for data entry on blank forms, however, for editing - the
forms dont open blank and are used to view and edit.

on the first Editing form when i click to go to next form of that
inparticluar survey i was veiwing(defined by id#) i want the next form to
open on the same record with same id.

i can't do it the way i did it in the data entry forms:

Dim strDocName As String
Dim strID As String
strDocName = "Water"
strID = Me.ID
DoCmd.Close
DoCmd.OpenForm strDocName
Forms(strDocName)!ID = strID

i think i need to use gotorecord or something in my next button click
event on the first edit page form????????? but i dunno anything about
access code... help plz???
 
S

Steve Conway

reservedbcreater said:
ok..... i have 2 versions of the same forms...
1 is for adding surveys into the db.

one is for editing....

the one for adding is fine - it auto assigns an ID# then whenever u go to
the next form of the surevy its takes the value from previous form and
puts it in currnet forms ID# field....

this is fine for data entry on blank forms, however, for editing - the
forms dont open blank and are used to view and edit.

on the first Editing form when i click to go to next form of that
inparticluar survey i was veiwing(defined by id#) i want the next form to
open on the same record with same id.

i can't do it the way i did it in the data entry forms:

Dim strDocName As String
Dim strID As String
strDocName = "Water"
strID = Me.ID
DoCmd.Close
DoCmd.OpenForm strDocName
Forms(strDocName)!ID = strID

i think i need to use gotorecord or something in my next button click
event on the first edit page form????????? but i dunno anything about
access code... help plz???

You can just change the code to

Dim strDocName As String
Dim strID As String
Dim strWhere As String
strDocName = "Water"
strID = Me.ID
strWhere = "ID = '" & strID & "'"
DoCmd.OpenForm strDocName, , , strWhere
DoCmd.Close acForm, Me.Name

This line, to make it easier to see/read
strWhere = "ID = ' " & strID & " ' "
is assuming that ID is a text data type, if it is numeric then change the
line to

strWhere = "ID = " & strID

HTH
Steve C
 
R

reservedbcreater

didnt work i dont think i explained myself correctly, i want the next form
to open on a certain record based on ID u fill in on the first form (it
asks u do pick an id - when u do it bring up the form filled out with that
id#'s record's information (id# = record#)

i dont need it to be assigned an id#
 

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

Top