Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I build a new record in my table (sales) as follows. The problem that I am
having is how to display the record. The last line of this code tries to do
the display but its not correct. Will someone tell me how I should code it.
To get it to display correctlly I exec a next record command, and then a
previous record command and I get the correct display.

DoCmd.GoToRecord , , acNewRec

Me![bidnumber] = bidnumber
Me![jobname] = jname
Me![city] = jcity
Me![state] = Jstate
Me![owner] = jowner
Me![Architect] = JArch
Me![engineer] = Jeng
Me![bid-type] = jbtype
Me![bid-priority] = jbpri
Me![bid-date] = jbdate
Me![start-date] = jsdate
Me![building-size] = jtsize
Me![type] = jtype

stDocName = "Sales"

DoCmd.OpenForm stDocName, acNormal, , , , acWindowNormal
 
To get it to display correctlly I exec a next record command, and then a
previous record command and I get the correct display.

Explicitly save the record before opening the second form:

DoCmd.GoToRecord , , acNewRec

Me![bidnumber] = bidnumber
Me![jobname] = jname
Me![city] = jcity
Me![state] = Jstate
Me![owner] = jowner
Me![Architect] = JArch
Me![engineer] = Jeng
Me![bid-type] = jbtype
Me![bid-priority] = jbpri
Me![bid-date] = jbdate
Me![start-date] = jsdate
Me![building-size] = jtsize
Me![type] = jtype

Me.Dirty = False ' this writes the current record to disk

stDocName = "Sales"

DoCmd.OpenForm stDocName, acNormal, , , , acWindowNormal

I find it very peculiar indeed that you're using two forms AND VBA code to
populate a record - why can't the Sales form simply be used to enter data???

John W. Vinson [MVP]
 
Back
Top