Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding field

Status
Not open for further replies.

PB90

Technical User
Jul 11, 2005
65
0
0
US
I have a subform (default view continuous forms). It is a single row. Using a query for data.

I need to add a blnfield, so if that field is checked I can take certain actions. I tried creating the field as blnDel: CBool(0), but this won't allow me to modify the field (I think because it is calculated?)

Any suggestions?
 
You can add Expressions to your query but not a "field" or more correctly a control. You will need to add your checkbox field to your tables and then add this field to your query. Then you can add the checkbox control to your continuous form so that you can take certain actions with.
 
This is where the problem lies, I need the check box associated with each record in the query. I added the column in the query (this doesn't work, I can't modify it) I can put a check box on the form, but how do I associate it with a particular row(s) in the query?

There can be 1-n number of rows in the subform, I need a check box in each row, and a way to know which check box I am referring to.
 
Add a Boolean (aka YesNo) field in the Table

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
This is what I'm down to. It is a secondary table, that bln field doesn't belong in any table, it is needed for my processing. Do I need to create a recordset or new temp table & put this field in there? If so, how could I create it with the field initially set to false? or just create the bln field in the new RS or table?
 
Did you add your field (PHV suggestion) to the table so you can add the control(checkbox) to your form so you can identify which record to perform your actions with?
 
I didn't add it to the table. The table the query & subform are based on is a secondary table. It holds records for a schedule. ex of records:

tbl1 table2
trkNum XXX rec1, trkNum XXX, dates
rec2, trkNum xxx, dates2
........ rec15, trknum XXX, dates15

the blnfield I need, doesn't belong in either table.
If I need to create a temporary table or recordset, I can take that suggestion and add the field there, then build the form off of that table....

Is that what I need to do?
 
Assuming that your subform records are based on a query containing Table1 and Table2 and you want to perform some action against those records then your field will be entered in Table2. Then include this field into your query and add the checkbox to your subform bound to this field...that is if I am understanding you correctly. Then you can select a specific record with your checkbox and perform whatever action you wanted to perform.
 
I don't know how I can make this clear. The bln field is not something to store, it is something for them to check if they want a particular action taken against that record. It DOES NOT belong in the table. Is there another way to do this, or must I create a third table of some sort to include this field, just for this particular form?
 
Unless someone can suggest something else, the only way I know to identify which record you want to take action on is to use one of the bound controls, whether it be an existing control and use the double click event to take your action or use any of the available events for that particular control. An alternate method would be to use a list box listing all the records and setting the listbox to multiselect and then you can select several records to take and perform actions on. No matter what method you prefer to use, you won't be able to make a checkbox control with your query to select the individual records. The suggestion of using a Yes/No field in the table was to provide a bound control(checkbox)in your subform which the user can check and uncheck the desired records. You can add some code that will change the checkbox back to No when you have finished performing your actions.

Sorry I couldn't be of more help.
 
It DOES NOT belong in the table
Bur it does belong to the record the user want a particular action.
Another way is to play with a MultiSelect ListBox instead of a continuous subform.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Maybe I'm making this too difficult. Here's the scenario. I have a submittal to use a resource. A person can select multiple start and end dates and multiple begin and end times. An example would be:
start start End End
date: hour Date: Hour:
Jan 1 10:00 Jan 5 12:59
Jan 13 2:00 Jan14 4:59

This would schedule Jan 1-5 from 10:00 to 12:59
Jan 13-14 from 2:00 to 4:59

I need a form which displays these dates, allows the user to change the times associated with any or all days, and delete a (row) if needed (i.e. the need for a check box)
The catch: I want to be able to NOT change the underlying schedule table until all the changes have been entered, and re-set the subform to the original dates/times if the user changes their mind.

My understanding is, that with a subform related to the main form, each record is modified as soon as the cursor leaves that record for the next one. I do not want this to occur (or at least I want to be able to back out of it).
Is this too difficult? Or am I going about it all wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top