Access Access 2003 GoToRecord Problems

Joined
Jul 27, 2011
Messages
1
Reaction score
0
I have a main form (Orders) with a subform (Orders Subform) for taking orders. When the user clicks on a button, a Search form pops up. The user selects one of the records, then clicks on a button on the search form which 1) captures data on the Search form, 2) closes the Search form, 3) goes to a new record on the Orders Subform, and 4) populates the record with the data captured from the Search form. If I leave out 3) everything works fine, but I can't get a new record and I need to do so. Here's the code on the button on the Search form:

Dim iISBN As String

'Capture data
iISBN = Me![Search Subform]("ISBN"))

'Close the Search form
DoCmd.Close acForm, "Search"

Forms!Orders![Orders Subform].Form.ISBN.SetFocus

'This is the statement that won't work
DoCmd.GoToRecord acDataForm, Forms!Orders![Orders Subform].Form, acNewRec

'Insert data from Search form - this works
Forms!Orders![Orders Subform].Form.ISBN = iISBN

The error for 3) is "An expression you entered is the wrong data type for one of the arguments."

Am I mis-specifying the path for the GoToRecord command? Thanks!
 
Last edited:
Back
Top