attack of the clones

CJBIRKIN

Drink!
Local time
Today, 14:05
Joined
May 10, 2002
Messages
256
Hello

I've created a form that allows the user to look for a training company and a sub form that shows the related trainers. What i wanted to do was allow the user to enter a new training company so i coded the following. The problem is that when the form is returned from me.dataentry = true to me.dataentry = false the form displays the first record. I have stored the record number in;

STRRSTCLONE = Str(Me![COMPANY_TRUST_ID]) before the change to preserve the number then afterwards i try to use it in the following;

RST.FindNext "[COMPANY_TRUST_ID] = " & STRRSTCLONE
Me.Bookmark = RST.Bookmark

but i doesn't work.

what i don't get is it's practically the same code that the combobox uses when its searches for a record.

Any ideas??

Chris


Private Sub CMD_ADD_Click()
Dim RST As DAO.Recordset
Dim STRRSTCLONE As String

If Me.CMD_ADD.Caption = "ADD NEW TRAINING SOURCE" Then
Me.CMD_ADD.Caption = "RETURN"
Me.TRAINER_SUBFORM.Visible = False
Me.CMBO_SEARCH.Visible = False
Me.DataEntry = True
Else

If Me.COMPANY_TRUST_DESCRIPTION <> Null Then
Me.CMD_ADD.Caption = "ADD NEW TRAINING SOURCE"
Me.CMBO_SEARCH.Visible = True

Set RST = Me.Recordset.Clone
STRRSTCLONE = Str(Me![COMPANY_TRUST_ID])
Me.TRAINER_SUBFORM.Visible = True
Me.DataEntry = False ' at this point rescordset goes to first record
RST![COMPANY_TRUST_ID] = STRRSTCLONE
RST.FindNext "[COMPANY_TRUST_ID] = " & STRRSTCLONE
Me.Bookmark = RST.Bookmark
End If

End If


End Sub
 
Try force saving the record after you have grabbed its ID something like

strID=Me.Company_Trust_ID

Docmd.RunCommand accmdSaveRecord

Now search for the record.

No promises though I think I tried this a while ago, without much success.
 

Users who are viewing this thread

Back
Top Bottom