Hi,
I need some advice for the best way to proceed with some code.
I use the following to update a form and then it opens a new form which asks for the following information:
GameID (on main form)
Batsman No (on main form)
Batsman Score (on main form)
Overs (on main form)
Wkt (on main form)
Total (on main form)
Dismissed By (on main form)
Dismissal Type (user selects)
When I open the form "frmDismissals"
I can get the fields default value to populate the field using: =[Forms]![frmGames]![tDate] etc
However, if I open the form and use the above it will need to know whether it looks at the left or right batsman?
Can I pass the info via some variable to the form so that when it opens so it populates the fields. This way I can use the same form for both batsman.
Or is there another way to do it?
Thanks in advance
Darrell.....
I need some advice for the best way to proceed with some code.
I use the following to update a form and then it opens a new form which asks for the following information:
GameID (on main form)
Batsman No (on main form)
Batsman Score (on main form)
Overs (on main form)
Wkt (on main form)
Total (on main form)
Dismissed By (on main form)
Dismissal Type (user selects)
When I open the form "frmDismissals"
I can get the fields default value to populate the field using: =[Forms]![frmGames]![tDate] etc
However, if I open the form and use the above it will need to know whether it looks at the left or right batsman?
Can I pass the info via some variable to the form so that when it opens so it populates the fields. This way I can use the same form for both batsman.
Or is there another way to do it?
Code:
Dim tLastMan, tLastWkt As Integer
If MsgBox("Do you wish to dismiss this Batsman?", vbQuestion + vbYesNo + vbDefaultButton2, "Dismiss Batsman") = vbNo Then
Exit Sub
Else
'updates lastman score
Me.tLastMan.Value = tLeftBatScore.Value
'updates last wkt score
Me.tLastWkt.Value = tTotal
'resets leftbatsmans score and number ready for next batsman
Me.tLeftBatScore.Value = 0
Me.tLeftBatNo.Value = 0
'increments the wkts
Me.tWkts.Value = Me.tWkts.Value + 1
'opens form for dismissal information
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmDismissals"
stLinkCriteria = "[tGameID]=" & Me![tID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Thanks in advance
Darrell.....
Last edited by a moderator: