Subform New Record

  • Thread starter Thread starter Pam
  • Start date Start date
P

Pam

Is this possible? Form A opens to job number from switchboard selection
with all related data from job table.

Form B, which is a subform on Form A, opens for tech to enter name and time
started on job. If Tech1 has already started time on job and Tech2 wants to
help on same job, it opens with Tech1's time. I need Form B to open to a
new record for Tech2 to enter time, but Form A still relate to job number
selected from switchboard.

Thanks in advance for any help,
Pam
 
Open Form B in design view, and set its Data Entry property to Yes.

Now the subform will always open to the new record (i.e. it doesn't show any
existing records.)
 
Pam
Is this possible? Form A opens to job number from switchboard selection
with all related data from job table.

assuming JobCode is your Primary key
place a unbound combobox on your switchboard named FindJobCodeCombo that has
your job number as its recordsource and on its afterupdate event put code
like this..

'*********** Code For FindJobCodeCombo **************
Private Sub FindJobCodeCombo_AfterUpdate()
On Error GoTo Err_FindJobCodeCombo_AfterUpdate

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Name of form A"
stLinkCriteria = Me!FindJobCodeCombo
DoCmd.OpenForm stDocName, , , , , , stLinkCriteria
Me!FindJobCodeCombo = Null

Exit_FindJobCodeCombo_AfterUpdate:
Exit Sub

Err_FindJobCodeCombo_AfterUpdate:
MsgBox Err.Description
Resume Exit_FindJobCodeCombo_AfterUpdate

End Sub

and this on FormA's on load

Private Sub Form_Load()
Dim rs As Object

If Me.OpenArgs = "GotoNew" And Not IsNull(Me![JobCode])
DoCmd.DoMenuItem acFormBar, 3, 0, , acMenuVer70
ElseIf Len(Me.OpenArgs & vbNullString) > 0 Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[JobCode] = " & Str(Nz(Me.OpenArgs, 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End If

End Sub
Form B, which is a subform on Form A, opens for tech to enter name and time
started on job. If Tech1 has already started time on job and Tech2 wants to
help on same job, it opens with Tech1's time. I need Form B to open to a
new record for Tech2 to enter time, but Form A still relate to job number
selected from switchboard.

Maybe formB should just be set to Datasheet view. and 80 techs could all
work the same job..

assuming you have a job codes table
and a linked table that has Times worked on job codes


link the two forms on JobCode then hide the jobCode field on the subform and
all records created in the datasheet subform will be for the jobcode listed
in FormA



Barry
 
Back
Top