Hello,
I have a table which lists various divisions in the organization:
tblDivision
>pkDivisionID
>txtDivisionName
I now have a table which tracks whether there have been any "events" at the said division.
tblEvents
>pkEventID
>fkDivisionID
>EventDate
>EventPerson
>EventDescription
I have a combo box on my main form with a list of the divisions, which when i click a command button, iwant to take me to a form where
a) I can either add new events
b) edit existing events.
I created a new form based on a query of the above two tables - it works fine to view already existing events i manually inserted into the "tblEvents" table, but if an event doesn't already exist for the division, it doesn't work (because i assume no record exists). Therefore, when i click on this command button on the main form, if no record exists, i want it to create a new record using the combo box divisionID.
I tried the below, but it doesn't work (doesn't allow me to enter any new events):
Any advice (note: "WhatUnit" is the combo box which contains a list of the divisions)?
Thanks for your help.
Andrew.
I have a table which lists various divisions in the organization:
tblDivision
>pkDivisionID
>txtDivisionName
I now have a table which tracks whether there have been any "events" at the said division.
tblEvents
>pkEventID
>fkDivisionID
>EventDate
>EventPerson
>EventDescription
I have a combo box on my main form with a list of the divisions, which when i click a command button, iwant to take me to a form where
a) I can either add new events
b) edit existing events.
I created a new form based on a query of the above two tables - it works fine to view already existing events i manually inserted into the "tblEvents" table, but if an event doesn't already exist for the division, it doesn't work (because i assume no record exists). Therefore, when i click on this command button on the main form, if no record exists, i want it to create a new record using the combo box divisionID.
I tried the below, but it doesn't work (doesn't allow me to enter any new events):
Code:
Private Sub cmdEvents_Click()
strWhereCondition = "[pkDivID] = " & WhatUnit
DoCmd.OpenForm "frmEvents", , , strWhereCondition
End Sub
Any advice (note: "WhatUnit" is the combo box which contains a list of the divisions)?
Thanks for your help.
Andrew.