Z
Zanstemic
I need some help with how to best approach two tables that are related as a
one to one relationship. I'm really not sure if this is the best approach.
On the main form I have a command button that launches the related form.
This works fine when the related record exists and has the AuthorizationID
matching
Dim AuthID As Long
Dim TripAuthID As String
AuthID = Me.txtAuthorizationID
' this saves the record prior to opening TripReport Form
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "TripReport", , , "[TripReport.AuthorizationID] =
[Forms]![Authorization]![txtAuthorizationID]"
I'm having difficulty when the record does not exist and one needs to be
created. When the TripReport Form loads, I have the following which does not
seem to run:
Dim AuthID As Integer
Dim TripAuthID As Integer
AuthID = [Forms]![Authorization]![txtAuthorizationID]
TripAuthID = Me.AuthorizationID
IsNull(TripAuthID) = True Then
DoCmd.GoToRecord , , acNewRec
TripAuthID = AuthID
Else
End If
End Sub
Any suggestions are appreciated.
one to one relationship. I'm really not sure if this is the best approach.
On the main form I have a command button that launches the related form.
This works fine when the related record exists and has the AuthorizationID
matching
Dim AuthID As Long
Dim TripAuthID As String
AuthID = Me.txtAuthorizationID
' this saves the record prior to opening TripReport Form
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "TripReport", , , "[TripReport.AuthorizationID] =
[Forms]![Authorization]![txtAuthorizationID]"
I'm having difficulty when the record does not exist and one needs to be
created. When the TripReport Form loads, I have the following which does not
seem to run:
Dim AuthID As Integer
Dim TripAuthID As Integer
AuthID = [Forms]![Authorization]![txtAuthorizationID]
TripAuthID = Me.AuthorizationID
IsNull(TripAuthID) = True Then
DoCmd.GoToRecord , , acNewRec
TripAuthID = AuthID
Else
End If
End Sub
Any suggestions are appreciated.