Posted on 2011-02-21
I have this form in continuous forms format with a listing of records for a Company.
To add a record, I have to press a button and it will add based on the EndUserID and ProjID of the record a user has clicked on.
The issue is that a user usually scrolls to the bottom of the form and clicks in the NEW RECORD row and starts to add data. If done this way then the EndUserID and ProjID are not associated with that record and the record just added woudl be unassociated and would not appear under the EndUserID and ProjID.
If a user was to click in the NEW RECORD row then in effect what I would be looking for is a solution to add the EndUserID and ProjID
Any ideas on how to do this? I hope the explanation is sufficient..pls ask if need more details.
here is the code under the ADD RECORD button: (I also have ON LOAD event in the form and will post)
Private Sub cmdAddRecord_Click()
Dim lngEndUserID As Long
Dim lngPrjID As Long
On Error GoTo cmdAddRecord_Click_Err
If Me.NewRecord Then
MsgBox "You're already at a New Record"
If Not IsNull(Me.EndUserID) Then
lngEndUserID = Me.EndUserID
lngPrjID = Me.ProjectID
On Error Resume Next
DoCmd.GoToRecord , , acNewRec
If (MacroError <> 0) Then
MsgBox MacroError.Description, vbOKOnly, ""
Me.EndUserID = lngEndUserID
Me.ProjectID = lngPrjID