Using VBA to limit the values in a combo box

A

ArielZusya

I've got a continuous subform that contains a combo box that has numbers
that correspond to seat numbers. The form (frmMain) brings up the record for
a given person and the subform (frmAction) allows the user to assign a seat
number if the user doesn't currently have one assigned or move the user from
the seat to which they are currently assigned to a new seat. There are a
fixed number of seats. The seat numbers are being stored in a table
(tblSeat). The action taken using sub form frmAction is stored in tblAction.
I'd like to limit the seats selectable to the seats not currently assigned.
Is there a simple way of doing this? Thanks for your help!
 
K

Klatuu

First, how do you know if a seat is assigned?
You would need to modify the row source of your comb box to be a query
filtered on seats not assigned. Then, it is necessary to requery the combo
each time a seat is assigned.
 
A

ArielZusya

Thanks for your message. To answer your question, I've been struggling with
the question of how to demonstrate that a seat is assigned. I've been
wondering if, on a very basic level, there is something I should do to the
table's structure so each seat can only be assigned to one person at a time.
I just don't know how to do that. As a response I've created this
form-subform situation where the sub has a list of each action taken for a
given person. One action is to seat the person. When this action is
selected, using afterupdate, a seat combo box is changed from visible = false
and locked = true to visible = true and locked = false.

I suppose the query would be to look at all the records in tblAction and
find the most recent assignment to a particular seat and then limit the list
by that query... I just don't know how to do that... It's causing my blood
pressure to rise and it’s giving me a headache... Often these two symptoms
together mean I'm taking the more difficult path but in this case I'm not
sure what I should do to make this easier. I'd like to ultimately be able to
generate a reports showing all actions taken, all actions taken for a given
person, all actions taken for a given seat, and current seats assigned...
which is why I've done this the way I've done this... though I am certainly
not married to it and would gladly try something else if you have any
suggestions on an easier way for me to do this. Your guidance is greatly
appreciated! Thanks!
 
K

Klatuu

Does this Action table include seat assignments?
Another question. Does the Action table specify an event? One would think
that for each event, the seat could be assigned.
 
A

ArielZusya

So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!
 
K

Klatuu

It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
 
A

ArielZusya

I think I follow all of that... but I have one clarifying question... the
event number... are you refering to the seat number or the tblEvent.ID_Event
or something else? Thanks!

Klatuu said:
It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!
 
K

Klatuu

No, I am referring to Event in tblAction. That would be to limit the seats
available to only those in the current event.
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
I think I follow all of that... but I have one clarifying question... the
event number... are you refering to the seat number or the tblEvent.ID_Event
or something else? Thanks!

Klatuu said:
It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!

:

Does this Action table include seat assignments?
Another question. Does the Action table specify an event? One would think
that for each event, the seat could be assigned.
--
Dave Hargis, Microsoft Access MVP


:

Thanks for your message. To answer your question, I've been struggling with
the question of how to demonstrate that a seat is assigned. I've been
wondering if, on a very basic level, there is something I should do to the
table's structure so each seat can only be assigned to one person at a time.
I just don't know how to do that. As a response I've created this
form-subform situation where the sub has a list of each action taken for a
given person. One action is to seat the person. When this action is
selected, using afterupdate, a seat combo box is changed from visible = false
and locked = true to visible = true and locked = false.

I suppose the query would be to look at all the records in tblAction and
find the most recent assignment to a particular seat and then limit the list
by that query... I just don't know how to do that... It's causing my blood
pressure to rise and it’s giving me a headache... Often these two symptoms
together mean I'm taking the more difficult path but in this case I'm not
sure what I should do to make this easier. I'd like to ultimately be able to
generate a reports showing all actions taken, all actions taken for a given
person, all actions taken for a given seat, and current seats assigned...
which is why I've done this the way I've done this... though I am certainly
not married to it and would gladly try something else if you have any
suggestions on an easier way for me to do this. Your guidance is greatly
appreciated! Thanks!

:

First, how do you know if a seat is assigned?
You would need to modify the row source of your comb box to be a query
filtered on seats not assigned. Then, it is necessary to requery the combo
each time a seat is assigned.
--
Dave Hargis, Microsoft Access MVP


:

I've got a continuous subform that contains a combo box that has numbers
that correspond to seat numbers. The form (frmMain) brings up the record for
a given person and the subform (frmAction) allows the user to assign a seat
number if the user doesn't currently have one assigned or move the user from
the seat to which they are currently assigned to a new seat. There are a
fixed number of seats. The seat numbers are being stored in a table
(tblSeat). The action taken using sub form frmAction is stored in tblAction.
I'd like to limit the seats selectable to the seats not currently assigned.
Is there a simple way of doing this? Thanks for your help!
 
A

ArielZusya

I feel like I'm getting so close... Trouble is I got the following error:

Syntax error (missing operator) in query expression 'NOT IN SELECT [Seat]
FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent'.

When I click OK it leaves "IN" highlighted... so I wonder if that's where
the trouble lies. Thoughts? Thanks so much for your help on this.

Klatuu said:
No, I am referring to Event in tblAction. That would be to limit the seats
available to only those in the current event.
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
I think I follow all of that... but I have one clarifying question... the
event number... are you refering to the seat number or the tblEvent.ID_Event
or something else? Thanks!

Klatuu said:
It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
--
Dave Hargis, Microsoft Access MVP


:

So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!

:

Does this Action table include seat assignments?
Another question. Does the Action table specify an event? One would think
that for each event, the seat could be assigned.
--
Dave Hargis, Microsoft Access MVP


:

Thanks for your message. To answer your question, I've been struggling with
the question of how to demonstrate that a seat is assigned. I've been
wondering if, on a very basic level, there is something I should do to the
table's structure so each seat can only be assigned to one person at a time.
I just don't know how to do that. As a response I've created this
form-subform situation where the sub has a list of each action taken for a
given person. One action is to seat the person. When this action is
selected, using afterupdate, a seat combo box is changed from visible = false
and locked = true to visible = true and locked = false.

I suppose the query would be to look at all the records in tblAction and
find the most recent assignment to a particular seat and then limit the list
by that query... I just don't know how to do that... It's causing my blood
pressure to rise and it’s giving me a headache... Often these two symptoms
together mean I'm taking the more difficult path but in this case I'm not
sure what I should do to make this easier. I'd like to ultimately be able to
generate a reports showing all actions taken, all actions taken for a given
person, all actions taken for a given seat, and current seats assigned...
which is why I've done this the way I've done this... though I am certainly
not married to it and would gladly try something else if you have any
suggestions on an easier way for me to do this. Your guidance is greatly
appreciated! Thanks!

:

First, how do you know if a seat is assigned?
You would need to modify the row source of your comb box to be a query
filtered on seats not assigned. Then, it is necessary to requery the combo
each time a seat is assigned.
--
Dave Hargis, Microsoft Access MVP


:

I've got a continuous subform that contains a combo box that has numbers
that correspond to seat numbers. The form (frmMain) brings up the record for
a given person and the subform (frmAction) allows the user to assign a seat
number if the user doesn't currently have one assigned or move the user from
the seat to which they are currently assigned to a new seat. There are a
fixed number of seats. The seat numbers are being stored in a table
(tblSeat). The action taken using sub form frmAction is stored in tblAction.
I'd like to limit the seats selectable to the seats not currently assigned.
Is there a simple way of doing this? Thanks for your help!
 
K

Klatuu

hhmmmm?
I don't know why that is happening. Try putting in parenthesis like this:
NOT IN (SELECT [Seat] FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent)
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
I feel like I'm getting so close... Trouble is I got the following error:

Syntax error (missing operator) in query expression 'NOT IN SELECT [Seat]
FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent'.

When I click OK it leaves "IN" highlighted... so I wonder if that's where
the trouble lies. Thoughts? Thanks so much for your help on this.

Klatuu said:
No, I am referring to Event in tblAction. That would be to limit the seats
available to only those in the current event.
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
I think I follow all of that... but I have one clarifying question... the
event number... are you refering to the seat number or the tblEvent.ID_Event
or something else? Thanks!

:

It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
--
Dave Hargis, Microsoft Access MVP


:

So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!

:

Does this Action table include seat assignments?
Another question. Does the Action table specify an event? One would think
that for each event, the seat could be assigned.
--
Dave Hargis, Microsoft Access MVP


:

Thanks for your message. To answer your question, I've been struggling with
the question of how to demonstrate that a seat is assigned. I've been
wondering if, on a very basic level, there is something I should do to the
table's structure so each seat can only be assigned to one person at a time.
I just don't know how to do that. As a response I've created this
form-subform situation where the sub has a list of each action taken for a
given person. One action is to seat the person. When this action is
selected, using afterupdate, a seat combo box is changed from visible = false
and locked = true to visible = true and locked = false.

I suppose the query would be to look at all the records in tblAction and
find the most recent assignment to a particular seat and then limit the list
by that query... I just don't know how to do that... It's causing my blood
pressure to rise and it’s giving me a headache... Often these two symptoms
together mean I'm taking the more difficult path but in this case I'm not
sure what I should do to make this easier. I'd like to ultimately be able to
generate a reports showing all actions taken, all actions taken for a given
person, all actions taken for a given seat, and current seats assigned...
which is why I've done this the way I've done this... though I am certainly
not married to it and would gladly try something else if you have any
suggestions on an easier way for me to do this. Your guidance is greatly
appreciated! Thanks!

:

First, how do you know if a seat is assigned?
You would need to modify the row source of your comb box to be a query
filtered on seats not assigned. Then, it is necessary to requery the combo
each time a seat is assigned.
--
Dave Hargis, Microsoft Access MVP


:

I've got a continuous subform that contains a combo box that has numbers
that correspond to seat numbers. The form (frmMain) brings up the record for
a given person and the subform (frmAction) allows the user to assign a seat
number if the user doesn't currently have one assigned or move the user from
the seat to which they are currently assigned to a new seat. There are a
fixed number of seats. The seat numbers are being stored in a table
(tblSeat). The action taken using sub form frmAction is stored in tblAction.
I'd like to limit the seats selectable to the seats not currently assigned.
Is there a simple way of doing this? Thanks for your help!
 
A

ArielZusya

that didn't seem to do it either... I was curious why Access always
highlighted "IN" after returning that error so for kicks I removed it and it
allowed me to update the rowsource without giving me the error but then when
I loaded the form it gave me a more complete error:


The record source '~sq_cfrmAction~sq_ccmbSeat' specified on this form or
report does not exist. The name of the recordsource may be misspelled, the
recordsource was deleted or renamed, or the recordsource exists in a
different database. In the Form or Report's Design view, display the
property sheet bu clicking the properties button, and then set the
RecordSource proporty to an existing table or query.


Would you be willing to walk me through the query one more time? I'm
worried that I'm still not completely understanding it. Here's what I think
I've got from it (and perhaps you can help correct my thinking on this):

Select the records in column [Seat] from tblSeat but only those not
appearing in the query when selecting the records in column [Seat] from
tblAction which have records in column [Event] being equal to the field on
the form corresponding to that column. Do I have that right?

I'm wondering if instead there is a way to query tblAction for the most
recent [Seat] entries put in for either the various actions that assign a
person to a seat for a given RefNum (RefNum is only associated with tblAction
through tblMain... through the person linked to the action... there is no
direct relationship between tblRefNum.RefNum and tblAction... at least not
now... would I need to change that?) and then select [Seat] from tblSeat
where not in that original query. Does that make sense? Is that possible to
do? Am I way off? Sorry I'm not getting this. Thanks for your help.

Klatuu said:
hhmmmm?
I don't know why that is happening. Try putting in parenthesis like this:
NOT IN (SELECT [Seat] FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent)
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
I feel like I'm getting so close... Trouble is I got the following error:

Syntax error (missing operator) in query expression 'NOT IN SELECT [Seat]
FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent'.

When I click OK it leaves "IN" highlighted... so I wonder if that's where
the trouble lies. Thoughts? Thanks so much for your help on this.

Klatuu said:
No, I am referring to Event in tblAction. That would be to limit the seats
available to only those in the current event.
--
Dave Hargis, Microsoft Access MVP


:

I think I follow all of that... but I have one clarifying question... the
event number... are you refering to the seat number or the tblEvent.ID_Event
or something else? Thanks!

:

It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
--
Dave Hargis, Microsoft Access MVP


:

So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!

:

Does this Action table include seat assignments?
Another question. Does the Action table specify an event? One would think
that for each event, the seat could be assigned.
--
Dave Hargis, Microsoft Access MVP


:

Thanks for your message. To answer your question, I've been struggling with
the question of how to demonstrate that a seat is assigned. I've been
wondering if, on a very basic level, there is something I should do to the
table's structure so each seat can only be assigned to one person at a time.
I just don't know how to do that. As a response I've created this
form-subform situation where the sub has a list of each action taken for a
given person. One action is to seat the person. When this action is
selected, using afterupdate, a seat combo box is changed from visible = false
and locked = true to visible = true and locked = false.

I suppose the query would be to look at all the records in tblAction and
find the most recent assignment to a particular seat and then limit the list
by that query... I just don't know how to do that... It's causing my blood
pressure to rise and it’s giving me a headache... Often these two symptoms
together mean I'm taking the more difficult path but in this case I'm not
sure what I should do to make this easier. I'd like to ultimately be able to
generate a reports showing all actions taken, all actions taken for a given
person, all actions taken for a given seat, and current seats assigned...
which is why I've done this the way I've done this... though I am certainly
not married to it and would gladly try something else if you have any
suggestions on an easier way for me to do this. Your guidance is greatly
appreciated! Thanks!

:

First, how do you know if a seat is assigned?
You would need to modify the row source of your comb box to be a query
filtered on seats not assigned. Then, it is necessary to requery the combo
each time a seat is assigned.
--
Dave Hargis, Microsoft Access MVP


:

I've got a continuous subform that contains a combo box that has numbers
that correspond to seat numbers. The form (frmMain) brings up the record for
a given person and the subform (frmAction) allows the user to assign a seat
number if the user doesn't currently have one assigned or move the user from
the seat to which they are currently assigned to a new seat. There are a
fixed number of seats. The seat numbers are being stored in a table
(tblSeat). The action taken using sub form frmAction is stored in tblAction.
I'd like to limit the seats selectable to the seats not currently assigned.
Is there a simple way of doing this? Thanks for your help!
 
A

ArielZusya

Little update:

Since last I posted I started playing with queries and came up with the
following queries which I think are getting me a step closer:

SELECT tblAction.Seat
FROM tblMain RIGHT JOIN tblAction ON tblMain.ID_Main = tblAction.Person
WHERE (((tblAction.Seat) Is Not Null) AND ((tblAction.Event)=4) AND
((tblMain.RefNum)="206CBR2985"));

This query (qryShowAllPeopleWithSeatEvents) returns the seat numbers
currently assigned in 206CBR2985. Next, I did this query:

SELECT tblSeat.Seat
FROM tblSeat RIGHT JOIN qryShowAllPeopleWithSeatEvents ON tblSeat.Seat <>
qryShowAllPeopleWithSeatEvents.Seat;

This query returns a peculuar list. In tblSeat.Seat there are 200 records
(1, 2, 3 ... 198, 199, 200). It is just that list of numbers corresponding
to the 200 seats. Right now, for testing purposes, I created a test set of
data of people in tblMain and then randomly chose them to assign to seats. I
assigned three people from tblMain to seats 1, 2, and 3 respectively. This
second query returns 597 records. Record 1 - 197 are seats 4 - 200, but
record 198 through 397 are seats 1 through 200 and record 398 - 597 are seats
1 through 200. I tried selecting distinct but that didn't get me there
either. I feel like this may be the way to proceed if I can just figure out
how to rewrite my sql to not query for each seat in both (which is what i
think is going on here, though I could be wrong). If I can figure out how to
get this query working I can next start working on determining the most
recent event for a given seat. Thanks for your help!

Klatuu said:
hhmmmm?
I don't know why that is happening. Try putting in parenthesis like this:
NOT IN (SELECT [Seat] FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent)
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
I feel like I'm getting so close... Trouble is I got the following error:

Syntax error (missing operator) in query expression 'NOT IN SELECT [Seat]
FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent'.

When I click OK it leaves "IN" highlighted... so I wonder if that's where
the trouble lies. Thoughts? Thanks so much for your help on this.

Klatuu said:
No, I am referring to Event in tblAction. That would be to limit the seats
available to only those in the current event.
--
Dave Hargis, Microsoft Access MVP


:

I think I follow all of that... but I have one clarifying question... the
event number... are you refering to the seat number or the tblEvent.ID_Event
or something else? Thanks!

:

It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
--
Dave Hargis, Microsoft Access MVP


:

So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!

:

Does this Action table include seat assignments?
Another question. Does the Action table specify an event? One would think
that for each event, the seat could be assigned.
--
Dave Hargis, Microsoft Access MVP


:

Thanks for your message. To answer your question, I've been struggling with
the question of how to demonstrate that a seat is assigned. I've been
wondering if, on a very basic level, there is something I should do to the
table's structure so each seat can only be assigned to one person at a time.
I just don't know how to do that. As a response I've created this
form-subform situation where the sub has a list of each action taken for a
given person. One action is to seat the person. When this action is
selected, using afterupdate, a seat combo box is changed from visible = false
and locked = true to visible = true and locked = false.

I suppose the query would be to look at all the records in tblAction and
find the most recent assignment to a particular seat and then limit the list
by that query... I just don't know how to do that... It's causing my blood
pressure to rise and it’s giving me a headache... Often these two symptoms
together mean I'm taking the more difficult path but in this case I'm not
sure what I should do to make this easier. I'd like to ultimately be able to
generate a reports showing all actions taken, all actions taken for a given
person, all actions taken for a given seat, and current seats assigned...
which is why I've done this the way I've done this... though I am certainly
not married to it and would gladly try something else if you have any
suggestions on an easier way for me to do this. Your guidance is greatly
appreciated! Thanks!

:

First, how do you know if a seat is assigned?
You would need to modify the row source of your comb box to be a query
filtered on seats not assigned. Then, it is necessary to requery the combo
each time a seat is assigned.
--
Dave Hargis, Microsoft Access MVP


:

I've got a continuous subform that contains a combo box that has numbers
that correspond to seat numbers. The form (frmMain) brings up the record for
a given person and the subform (frmAction) allows the user to assign a seat
number if the user doesn't currently have one assigned or move the user from
the seat to which they are currently assigned to a new seat. There are a
fixed number of seats. The seat numbers are being stored in a table
(tblSeat). The action taken using sub form frmAction is stored in tblAction.
I'd like to limit the seats selectable to the seats not currently assigned.
Is there a simple way of doing this? Thanks for your help!
 
K

Klatuu

Try changing it to a Left JOIN
I don't know why the IN is a problem for you. I use it regularly
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
Little update:

Since last I posted I started playing with queries and came up with the
following queries which I think are getting me a step closer:

SELECT tblAction.Seat
FROM tblMain RIGHT JOIN tblAction ON tblMain.ID_Main = tblAction.Person
WHERE (((tblAction.Seat) Is Not Null) AND ((tblAction.Event)=4) AND
((tblMain.RefNum)="206CBR2985"));

This query (qryShowAllPeopleWithSeatEvents) returns the seat numbers
currently assigned in 206CBR2985. Next, I did this query:

SELECT tblSeat.Seat
FROM tblSeat RIGHT JOIN qryShowAllPeopleWithSeatEvents ON tblSeat.Seat <>
qryShowAllPeopleWithSeatEvents.Seat;

This query returns a peculuar list. In tblSeat.Seat there are 200 records
(1, 2, 3 ... 198, 199, 200). It is just that list of numbers corresponding
to the 200 seats. Right now, for testing purposes, I created a test set of
data of people in tblMain and then randomly chose them to assign to seats. I
assigned three people from tblMain to seats 1, 2, and 3 respectively. This
second query returns 597 records. Record 1 - 197 are seats 4 - 200, but
record 198 through 397 are seats 1 through 200 and record 398 - 597 are seats
1 through 200. I tried selecting distinct but that didn't get me there
either. I feel like this may be the way to proceed if I can just figure out
how to rewrite my sql to not query for each seat in both (which is what i
think is going on here, though I could be wrong). If I can figure out how to
get this query working I can next start working on determining the most
recent event for a given seat. Thanks for your help!

Klatuu said:
hhmmmm?
I don't know why that is happening. Try putting in parenthesis like this:
NOT IN (SELECT [Seat] FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent)
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
I feel like I'm getting so close... Trouble is I got the following error:

Syntax error (missing operator) in query expression 'NOT IN SELECT [Seat]
FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent'.

When I click OK it leaves "IN" highlighted... so I wonder if that's where
the trouble lies. Thoughts? Thanks so much for your help on this.

:

No, I am referring to Event in tblAction. That would be to limit the seats
available to only those in the current event.
--
Dave Hargis, Microsoft Access MVP


:

I think I follow all of that... but I have one clarifying question... the
event number... are you refering to the seat number or the tblEvent.ID_Event
or something else? Thanks!

:

It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
--
Dave Hargis, Microsoft Access MVP


:

So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!

:

Does this Action table include seat assignments?
Another question. Does the Action table specify an event? One would think
that for each event, the seat could be assigned.
--
Dave Hargis, Microsoft Access MVP


:

Thanks for your message. To answer your question, I've been struggling with
the question of how to demonstrate that a seat is assigned. I've been
wondering if, on a very basic level, there is something I should do to the
table's structure so each seat can only be assigned to one person at a time.
I just don't know how to do that. As a response I've created this
form-subform situation where the sub has a list of each action taken for a
given person. One action is to seat the person. When this action is
selected, using afterupdate, a seat combo box is changed from visible = false
and locked = true to visible = true and locked = false.

I suppose the query would be to look at all the records in tblAction and
find the most recent assignment to a particular seat and then limit the list
by that query... I just don't know how to do that... It's causing my blood
pressure to rise and it’s giving me a headache... Often these two symptoms
together mean I'm taking the more difficult path but in this case I'm not
sure what I should do to make this easier. I'd like to ultimately be able to
generate a reports showing all actions taken, all actions taken for a given
person, all actions taken for a given seat, and current seats assigned...
which is why I've done this the way I've done this... though I am certainly
not married to it and would gladly try something else if you have any
suggestions on an easier way for me to do this. Your guidance is greatly
appreciated! Thanks!

:

First, how do you know if a seat is assigned?
You would need to modify the row source of your comb box to be a query
filtered on seats not assigned. Then, it is necessary to requery the combo
each time a seat is assigned.
--
Dave Hargis, Microsoft Access MVP


:

I've got a continuous subform that contains a combo box that has numbers
that correspond to seat numbers. The form (frmMain) brings up the record for
a given person and the subform (frmAction) allows the user to assign a seat
number if the user doesn't currently have one assigned or move the user from
the seat to which they are currently assigned to a new seat. There are a
fixed number of seats. The seat numbers are being stored in a table
(tblSeat). The action taken using sub form frmAction is stored in tblAction.
I'd like to limit the seats selectable to the seats not currently assigned.
Is there a simple way of doing this? Thanks for your help!
 
A

ArielZusya

I think my installation of MS Access is a bit like a wild bear... it senses
my fear and then plays with me until I pass out. Seriously though... I have
no idea why things like IN aren't working for me. The other day I had this
strange problem where Insert queries weren't working and giving me all sorts
of errors. After trying all sorts of things I eventually deleted the table
into which the insert query was sending the data and I rebuilt it (exactly as
the one I deleted was built) and suddenly everything worked (without changing
the SQL statement). So... bear... or maybe my machine is haunted. Dunno.

so... I feel like I need to appologize... I initially thought I would be
handling this situation using code on my form and it appears this question
has ended up a query question. Worrying that, as a result of this fact, I
was going to wear on your patients (I do appreciate how patient you've been
with me... thanks for that), I posted a simplified (at least I think it's
simplified... it's getting hard to tell these days) version of this question
in the .queries section. If you stick to the coding side of things I'd
understand if you'd prefer me to seek further assistance there. Let me know.

In the meantime, in case you don't mind continuing with me here, I tried
that left-join change and instead of showing me 4-200 and then 1-200, 1-200,
it showed me 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, etc. To attempt to counter
that effect I tried adding DISTINCT to my select and it returned 1 - 200. Do
I need to reinstall or am I not writing my SQL the way I need to write it?
Thanks again for all your help.

Klatuu said:
Try changing it to a Left JOIN
I don't know why the IN is a problem for you. I use it regularly
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
Little update:

Since last I posted I started playing with queries and came up with the
following queries which I think are getting me a step closer:

SELECT tblAction.Seat
FROM tblMain RIGHT JOIN tblAction ON tblMain.ID_Main = tblAction.Person
WHERE (((tblAction.Seat) Is Not Null) AND ((tblAction.Event)=4) AND
((tblMain.RefNum)="206CBR2985"));

This query (qryShowAllPeopleWithSeatEvents) returns the seat numbers
currently assigned in 206CBR2985. Next, I did this query:

SELECT tblSeat.Seat
FROM tblSeat RIGHT JOIN qryShowAllPeopleWithSeatEvents ON tblSeat.Seat <>
qryShowAllPeopleWithSeatEvents.Seat;

This query returns a peculuar list. In tblSeat.Seat there are 200 records
(1, 2, 3 ... 198, 199, 200). It is just that list of numbers corresponding
to the 200 seats. Right now, for testing purposes, I created a test set of
data of people in tblMain and then randomly chose them to assign to seats. I
assigned three people from tblMain to seats 1, 2, and 3 respectively. This
second query returns 597 records. Record 1 - 197 are seats 4 - 200, but
record 198 through 397 are seats 1 through 200 and record 398 - 597 are seats
1 through 200. I tried selecting distinct but that didn't get me there
either. I feel like this may be the way to proceed if I can just figure out
how to rewrite my sql to not query for each seat in both (which is what i
think is going on here, though I could be wrong). If I can figure out how to
get this query working I can next start working on determining the most
recent event for a given seat. Thanks for your help!

Klatuu said:
hhmmmm?
I don't know why that is happening. Try putting in parenthesis like this:
NOT IN (SELECT [Seat] FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent)
--
Dave Hargis, Microsoft Access MVP


:

I feel like I'm getting so close... Trouble is I got the following error:

Syntax error (missing operator) in query expression 'NOT IN SELECT [Seat]
FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent'.

When I click OK it leaves "IN" highlighted... so I wonder if that's where
the trouble lies. Thoughts? Thanks so much for your help on this.

:

No, I am referring to Event in tblAction. That would be to limit the seats
available to only those in the current event.
--
Dave Hargis, Microsoft Access MVP


:

I think I follow all of that... but I have one clarifying question... the
event number... are you refering to the seat number or the tblEvent.ID_Event
or something else? Thanks!

:

It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
--
Dave Hargis, Microsoft Access MVP


:

So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!

:

Does this Action table include seat assignments?
Another question. Does the Action table specify an event? One would think
that for each event, the seat could be assigned.
--
Dave Hargis, Microsoft Access MVP


:

Thanks for your message. To answer your question, I've been struggling with
the question of how to demonstrate that a seat is assigned. I've been
wondering if, on a very basic level, there is something I should do to the
table's structure so each seat can only be assigned to one person at a time.
I just don't know how to do that. As a response I've created this
form-subform situation where the sub has a list of each action taken for a
given person. One action is to seat the person. When this action is
selected, using afterupdate, a seat combo box is changed from visible = false
and locked = true to visible = true and locked = false.

I suppose the query would be to look at all the records in tblAction and
find the most recent assignment to a particular seat and then limit the list
by that query... I just don't know how to do that... It's causing my blood
pressure to rise and it’s giving me a headache... Often these two symptoms
together mean I'm taking the more difficult path but in this case I'm not
sure what I should do to make this easier. I'd like to ultimately be able to
generate a reports showing all actions taken, all actions taken for a given
person, all actions taken for a given seat, and current seats assigned...
which is why I've done this the way I've done this... though I am certainly
not married to it and would gladly try something else if you have any
suggestions on an easier way for me to do this. Your guidance is greatly
appreciated! Thanks!

:

First, how do you know if a seat is assigned?
You would need to modify the row source of your comb box to be a query
filtered on seats not assigned. Then, it is necessary to requery the combo
each time a seat is assigned.
--
Dave Hargis, Microsoft Access MVP


:

I've got a continuous subform that contains a combo box that has numbers
that correspond to seat numbers. The form (frmMain) brings up the record for
a given person and the subform (frmAction) allows the user to assign a seat
number if the user doesn't currently have one assigned or move the user from
the seat to which they are currently assigned to a new seat. There are a
fixed number of seats. The seat numbers are being stored in a table
(tblSeat). The action taken using sub form frmAction is stored in tblAction.
I'd like to limit the seats selectable to the seats not currently assigned.
Is there a simple way of doing this? Thanks for your help!
 
K

Klatuu

I would be happy to help, but I don't understand the problems you are having.
The original query I described should do the job. I wonder if you have
corruption in your database?

Get the info from this site:
http://www.granite.ab.ca/access/decompile.htm

decompile your database, then compact and repair and see if that helps.

--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
I think my installation of MS Access is a bit like a wild bear... it senses
my fear and then plays with me until I pass out. Seriously though... I have
no idea why things like IN aren't working for me. The other day I had this
strange problem where Insert queries weren't working and giving me all sorts
of errors. After trying all sorts of things I eventually deleted the table
into which the insert query was sending the data and I rebuilt it (exactly as
the one I deleted was built) and suddenly everything worked (without changing
the SQL statement). So... bear... or maybe my machine is haunted. Dunno.

so... I feel like I need to appologize... I initially thought I would be
handling this situation using code on my form and it appears this question
has ended up a query question. Worrying that, as a result of this fact, I
was going to wear on your patients (I do appreciate how patient you've been
with me... thanks for that), I posted a simplified (at least I think it's
simplified... it's getting hard to tell these days) version of this question
in the .queries section. If you stick to the coding side of things I'd
understand if you'd prefer me to seek further assistance there. Let me know.

In the meantime, in case you don't mind continuing with me here, I tried
that left-join change and instead of showing me 4-200 and then 1-200, 1-200,
it showed me 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, etc. To attempt to counter
that effect I tried adding DISTINCT to my select and it returned 1 - 200. Do
I need to reinstall or am I not writing my SQL the way I need to write it?
Thanks again for all your help.

Klatuu said:
Try changing it to a Left JOIN
I don't know why the IN is a problem for you. I use it regularly
--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
Little update:

Since last I posted I started playing with queries and came up with the
following queries which I think are getting me a step closer:

SELECT tblAction.Seat
FROM tblMain RIGHT JOIN tblAction ON tblMain.ID_Main = tblAction.Person
WHERE (((tblAction.Seat) Is Not Null) AND ((tblAction.Event)=4) AND
((tblMain.RefNum)="206CBR2985"));

This query (qryShowAllPeopleWithSeatEvents) returns the seat numbers
currently assigned in 206CBR2985. Next, I did this query:

SELECT tblSeat.Seat
FROM tblSeat RIGHT JOIN qryShowAllPeopleWithSeatEvents ON tblSeat.Seat <>
qryShowAllPeopleWithSeatEvents.Seat;

This query returns a peculuar list. In tblSeat.Seat there are 200 records
(1, 2, 3 ... 198, 199, 200). It is just that list of numbers corresponding
to the 200 seats. Right now, for testing purposes, I created a test set of
data of people in tblMain and then randomly chose them to assign to seats. I
assigned three people from tblMain to seats 1, 2, and 3 respectively. This
second query returns 597 records. Record 1 - 197 are seats 4 - 200, but
record 198 through 397 are seats 1 through 200 and record 398 - 597 are seats
1 through 200. I tried selecting distinct but that didn't get me there
either. I feel like this may be the way to proceed if I can just figure out
how to rewrite my sql to not query for each seat in both (which is what i
think is going on here, though I could be wrong). If I can figure out how to
get this query working I can next start working on determining the most
recent event for a given seat. Thanks for your help!

:

hhmmmm?
I don't know why that is happening. Try putting in parenthesis like this:
NOT IN (SELECT [Seat] FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent)
--
Dave Hargis, Microsoft Access MVP


:

I feel like I'm getting so close... Trouble is I got the following error:

Syntax error (missing operator) in query expression 'NOT IN SELECT [Seat]
FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent'.

When I click OK it leaves "IN" highlighted... so I wonder if that's where
the trouble lies. Thoughts? Thanks so much for your help on this.

:

No, I am referring to Event in tblAction. That would be to limit the seats
available to only those in the current event.
--
Dave Hargis, Microsoft Access MVP


:

I think I follow all of that... but I have one clarifying question... the
event number... are you refering to the seat number or the tblEvent.ID_Event
or something else? Thanks!

:

It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
--
Dave Hargis, Microsoft Access MVP


:

So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!

:

Does this Action table include seat assignments?
Another question. Does the Action table specify an event? One would think
that for each event, the seat could be assigned.
--
Dave Hargis, Microsoft Access MVP


:

Thanks for your message. To answer your question, I've been struggling with
the question of how to demonstrate that a seat is assigned. I've been
wondering if, on a very basic level, there is something I should do to the
table's structure so each seat can only be assigned to one person at a time.
I just don't know how to do that. As a response I've created this
form-subform situation where the sub has a list of each action taken for a
given person. One action is to seat the person. When this action is
selected, using afterupdate, a seat combo box is changed from visible = false
and locked = true to visible = true and locked = false.

I suppose the query would be to look at all the records in tblAction and
find the most recent assignment to a particular seat and then limit the list
by that query... I just don't know how to do that... It's causing my blood
pressure to rise and it’s giving me a headache... Often these two symptoms
together mean I'm taking the more difficult path but in this case I'm not
sure what I should do to make this easier. I'd like to ultimately be able to
generate a reports showing all actions taken, all actions taken for a given
person, all actions taken for a given seat, and current seats assigned...
which is why I've done this the way I've done this... though I am certainly
not married to it and would gladly try something else if you have any
suggestions on an easier way for me to do this. Your guidance is greatly
appreciated! Thanks!

:

First, how do you know if a seat is assigned?
You would need to modify the row source of your comb box to be a query
filtered on seats not assigned. Then, it is necessary to requery the combo
each time a seat is assigned.
--
Dave Hargis, Microsoft Access MVP


:

I've got a continuous subform that contains a combo box that has numbers
that correspond to seat numbers. The form (frmMain) brings up the record for
a given person and the subform (frmAction) allows the user to assign a seat
number if the user doesn't currently have one assigned or move the user from
the seat to which they are currently assigned to a new seat. There are a
fixed number of seats. The seat numbers are being stored in a table
(tblSeat). The action taken using sub form frmAction is stored in tblAction.
I'd like to limit the seats selectable to the seats not currently assigned.
Is there a simple way of doing this? Thanks for your help!
 
A

ArielZusya

Thanks for all your help. I tried the decompile recompile and it may have
helped but then I got to thinking about the structure of the database and I
think it wasn't as efficient a design as I wanted. Consequently I rebuilt it
from the ground up (incorporating all the things I've learned from the first
generation of this project). At least for the moment things are progressing
smoothly. I'm sure I'll be back posting questions when I hit my next bump.
Thanks again for all your help!

Klatuu said:
I would be happy to help, but I don't understand the problems you are having.
The original query I described should do the job. I wonder if you have
corruption in your database?

Get the info from this site:
http://www.granite.ab.ca/access/decompile.htm

decompile your database, then compact and repair and see if that helps.

--
Dave Hargis, Microsoft Access MVP


ArielZusya said:
I think my installation of MS Access is a bit like a wild bear... it senses
my fear and then plays with me until I pass out. Seriously though... I have
no idea why things like IN aren't working for me. The other day I had this
strange problem where Insert queries weren't working and giving me all sorts
of errors. After trying all sorts of things I eventually deleted the table
into which the insert query was sending the data and I rebuilt it (exactly as
the one I deleted was built) and suddenly everything worked (without changing
the SQL statement). So... bear... or maybe my machine is haunted. Dunno.

so... I feel like I need to appologize... I initially thought I would be
handling this situation using code on my form and it appears this question
has ended up a query question. Worrying that, as a result of this fact, I
was going to wear on your patients (I do appreciate how patient you've been
with me... thanks for that), I posted a simplified (at least I think it's
simplified... it's getting hard to tell these days) version of this question
in the .queries section. If you stick to the coding side of things I'd
understand if you'd prefer me to seek further assistance there. Let me know.

In the meantime, in case you don't mind continuing with me here, I tried
that left-join change and instead of showing me 4-200 and then 1-200, 1-200,
it showed me 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, etc. To attempt to counter
that effect I tried adding DISTINCT to my select and it returned 1 - 200. Do
I need to reinstall or am I not writing my SQL the way I need to write it?
Thanks again for all your help.

Klatuu said:
Try changing it to a Left JOIN
I don't know why the IN is a problem for you. I use it regularly
--
Dave Hargis, Microsoft Access MVP


:

Little update:

Since last I posted I started playing with queries and came up with the
following queries which I think are getting me a step closer:

SELECT tblAction.Seat
FROM tblMain RIGHT JOIN tblAction ON tblMain.ID_Main = tblAction.Person
WHERE (((tblAction.Seat) Is Not Null) AND ((tblAction.Event)=4) AND
((tblMain.RefNum)="206CBR2985"));

This query (qryShowAllPeopleWithSeatEvents) returns the seat numbers
currently assigned in 206CBR2985. Next, I did this query:

SELECT tblSeat.Seat
FROM tblSeat RIGHT JOIN qryShowAllPeopleWithSeatEvents ON tblSeat.Seat <>
qryShowAllPeopleWithSeatEvents.Seat;

This query returns a peculuar list. In tblSeat.Seat there are 200 records
(1, 2, 3 ... 198, 199, 200). It is just that list of numbers corresponding
to the 200 seats. Right now, for testing purposes, I created a test set of
data of people in tblMain and then randomly chose them to assign to seats. I
assigned three people from tblMain to seats 1, 2, and 3 respectively. This
second query returns 597 records. Record 1 - 197 are seats 4 - 200, but
record 198 through 397 are seats 1 through 200 and record 398 - 597 are seats
1 through 200. I tried selecting distinct but that didn't get me there
either. I feel like this may be the way to proceed if I can just figure out
how to rewrite my sql to not query for each seat in both (which is what i
think is going on here, though I could be wrong). If I can figure out how to
get this query working I can next start working on determining the most
recent event for a given seat. Thanks for your help!

:

hhmmmm?
I don't know why that is happening. Try putting in parenthesis like this:
NOT IN (SELECT [Seat] FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent)
--
Dave Hargis, Microsoft Access MVP


:

I feel like I'm getting so close... Trouble is I got the following error:

Syntax error (missing operator) in query expression 'NOT IN SELECT [Seat]
FROM tblAction WHERE [Event] = Forms!frmAction!cmbEvent'.

When I click OK it leaves "IN" highlighted... so I wonder if that's where
the trouble lies. Thoughts? Thanks so much for your help on this.

:

No, I am referring to Event in tblAction. That would be to limit the seats
available to only those in the current event.
--
Dave Hargis, Microsoft Access MVP


:

I think I follow all of that... but I have one clarifying question... the
event number... are you refering to the seat number or the tblEvent.ID_Event
or something else? Thanks!

:

It might look something like this:

SELECT [Seat] From tblSeat WHERE NOT IN SELECT [Seat] FROM tblAction WHERE
[Event] = Forms!MyForm!txtSeat;

Hopefully, you have the event number in a control on your form. It the
above, I call it txtSeat. You will have to change that to use your actual
name. Also, note that in Forms!MyForm you will need to change MyForm to the
name of your form. Stored queries do not understand Me.

Notice the second SELECT statment. This is known as a sub query. It is a
query within a query. The above query will only return seat numbers that are
not in the sub query.
--
Dave Hargis, Microsoft Access MVP


:

So... I don't know if this is going to make talking about my little (read
/overwhelmingly large for a noob like me/) project easier or more difficult
but I'm going to give it a shot and hope for the best. Here are my tables:

tblMain
.ID_Main, AutoNumber, PrimaryKey
.FirstName, text, First Name of Person
.LastName, text, Last Name of Person
.UserIdentifier, text, Person’s Driver’s License
.RefNum, text, Unique ref num for show
.Status, num, link to status

tblRefNum
.RefNum, text, PrimaryKey
.BatchNum, text, PrimaryKey
.ShowName, text, name of the show
.Location, num, link to location
.Type, num, link to type
.Stage, num, link to stage

tblStatus
.ID_Status, AutoNumber, PrimaryKey
.Status, text, is person seated, waiting, etc.

tblSeat
.Seat num, PrimaryKey, fixed list of seat numbers

tblAction
.ID_Action, AutoNumber, PrimaryKey
.Person, num, link to person in tblMain
.Event, num, link to event
.Reason, num, link to reason
.Seat, num, link to seat

tblEvent
.ID_Event, AutoNumber, PrimaryKey
.Event, text, WaitList, Seated, Moved, etc.

tblReason
.ID_Reason, AutoNumber, PrimaryKey
.Reason, text, WillCall, Return, BetterSeat, etc.

tblLocation
.ID_Location, AutoNumber, PrimaryKey
.Location, text, Theater Name

tblType
.ID_Type, AutoNumber, PrimaryKey
.Type, text, Dramatic, Musical, Variety, etc.

tblStage
.ID_Stage, AutoNumber, PrimaryKey
.Stage, text, Pre-Sale, DayOf, etc.

Relationships (one : many):

tblMain.ID_Main : tblAction.Person
tblMain.RefNum : tblRefNum.RefNum
tblMain.Status : tblStatus.ID_Status
tblRefNum.Location : tblLocation.ID_Location
tblRefNum.Type : tblType.ID_Type
tblRefNum.Stage : tblStage.ID_Stage
tblAction.Event : tblEvent.ID_Event
tblAction.Reason : tblReason.ID_Reason
tblAction.Seat : tblSeat.Seat

The way I have this setup is to have the user enter information about a
person into a form, storing said data in tblMain. Then the user using a
separate form creates events for that person (like being seated in a
particular seat or being moved to another seat or being put on a waitlist).
Each of those events have subevents (being seated would require a user to
select a seat number, or being moved would require a user to select a new
seat number). I hope some of this is making sense… It’s a tiny bit more
clear in my head than it probably is in this post and it's becoming less and
less amorphous as I work through this but it is still a struggle for me.
Anyhow… that’s where I am now… Does this look like I’m going about this
right? From this is it possible to query to return only the seats not
currently used? Do I need to add or ditch any fields? Any help will be
greatly appreciated. Thanks!

:

Does this Action table include seat assignments?
Another question. Does the Action table specify an event? One would think
that for each event, the seat could be assigned.
--
Dave Hargis, Microsoft Access MVP


:

Thanks for your message. To answer your question, I've been struggling with
the question of how to demonstrate that a seat is assigned. I've been
wondering if, on a very basic level, there is something I should do to the
table's structure so each seat can only be assigned to one person at a time.
I just don't know how to do that. As a response I've created this
form-subform situation where the sub has a list of each action taken for a
given person. One action is to seat the person. When this action is
selected, using afterupdate, a seat combo box is changed from visible = false
and locked = true to visible = true and locked = false.

I suppose the query would be to look at all the records in tblAction and
find the most recent assignment to a particular seat and then limit the list
by that query... I just don't know how to do that... It's causing my blood
pressure to rise and it’s giving me a headache... Often these two symptoms
together mean I'm taking the more difficult path but in this case I'm not
sure what I should do to make this easier. I'd like to ultimately be able to
generate a reports showing all actions taken, all actions taken for a given
person, all actions taken for a given seat, and current seats assigned...
which is why I've done this the way I've done this... though I am certainly
not married to it and would gladly try something else if you have any
suggestions on an easier way for me to do this. Your guidance is greatly
appreciated! Thanks!

:

First, how do you know if a seat is assigned?
You would need to modify the row source of your comb box to be a query
filtered on seats not assigned. Then, it is necessary to requery the combo
each time a seat is assigned.
--
Dave Hargis, Microsoft Access MVP


:

I've got a continuous subform that contains a combo box that has numbers
that correspond to seat numbers. The form (frmMain) brings up the record for
a given person and the subform (frmAction) allows the user to assign a seat
number if the user doesn't currently have one assigned or move the user from
the seat to which they are currently assigned to a new seat. There are a
fixed number of seats. The seat numbers are being stored in a table
(tblSeat). The action taken using sub form frmAction is stored in tblAction.
I'd like to limit the seats selectable to the seats not currently assigned.
Is there a simple way of doing this? Thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top