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!

Tabular form

Status
Not open for further replies.

kronar30

Programmer
Sep 8, 2004
74
US
How can i know what row (occurance) the user has made a change in in a Tabular Form?
 
How are ya kronar30 . . .

You can show the last edited in many ways. As a simple demo, put an unbound textbox in the header of a form. Then in the forms [blue]On Dirty[/blue] event, copy/paste the following line:
Code:
[blue]   Me.[purple][b]UnboundTextboxName[/b][/purple] = Me.CurrentRecord[/blue]
The textbox will update anytime you edit a record and show the currently edited record number (same as that in the navigation buttons).

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
I added a text box to the header. But can not find the 'on dirty' event in the forms events list??

The tabular form displays a list of records from the querry. When the user clicks the 'delete sw' or the 'edit sw' I would like to highlight the record by changing the background color of each field in the record.
 
I'm having trouble seeing what these are: 'delete sw' or the 'edit sw'. Surely you can provide more complete information about what you are attempting to do and why.

Duane
Hook'D on Access
MS Access MVP
 
delete sw and edit sw are just boolean check boxes that users can click to delete or edit that record.
 
Are you wanting to identify a record that has any row changed or just the check boxes? What would you expect if multiple records have changed?

I assume the check boxes are bound to fields in the form's record source.

Duane
Hook'D on Access
MS Access MVP
 
The delete sw is in the record, the edit sw will cause a record edit form to open. The rest of the fields will be non updateable in this form.
 
using the Edit sw to identify the row (record) so I can pass it to the edit form. The delete sw to highlight the record so I can later prompt the user to delete all records he has selected to delete. I really want to capture users action after each edit or delete sw click.
 
Use conditional formatting to highlight the records where the delete box is checked. Use code in the after update of the edit check box (not sure I care for using a check box for this)
Code:
Dim strWhere as String
strWhere = "[PrimaryKeyFieldName] = " & [PrimaryKeyFieldName]
DoCmd.OpenForm "frmYourFormName", , , strWhere


Duane
Hook'D on Access
MS Access MVP
 
Ok, that helped some.
I captured the JobBidNo field from the selected record in the strWhere, so have the selected record key. But when I check the editsw - all occurances of the editsw get checked (edit sw is not a field in the record just on the tabular form)
How to check only the selected records edit check box

When I use the same code for the deletesw - then only that records deletesw gets checked ( delete sw is a field in the record)
But when I use this deletesw to change the background color of one of the fields displayed - all occurances of that field change the background color.
How do I select only the active records background color?
 
So if I wanted to use a command button for delete, I would set it up to delete the selected record or records , if any are selected??
 
I am triing to use this query form as a look-up table to select the record to delete or edit. When the user sets the delete-sw in one of the records - it updates the record with the new field setting(delete-sw); however when I try to do a find first and then delete the desired record - the delete fails (I think it is because the record is already in use in the subform window). Then how do I refresh the subform to no longer show the deleted record??
 
Sorry, forgot to add tmy code:

Private Sub frmDeletesw_Click()
'delete this record
strBidNo = JB_JobBidNo
MsgBox strBidNo & " delete this record - delete code here"
Stop
Set JBrec = db.OpenRecordset("JB_Jobs", dbOpenDynaset)

JBrec.FindFirst "JB_JobBidNo = " & strQuote & strBidNo & strQuote
If JBrec.NoMatch Then
MsgBox "Bid " & strBidNo & " not found"

Else
'this works!
MsgBox "Current record to delete is " & JBrec(0)
JBrec.Delete
JBrec.MoveNext
MsgBox "MoveNext " & JBrec(0)
JBrec.Close
End If
'frmBidName.BackColor = 0
End Sub
 
Why are you creating a recordset to delete a record. You can delete the current record in a form with code like:
Code:
    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdDeleteRecord
You can also execute a delete sql statement which is more efficient than creating a recordset.

Duane
Hook'D on Access
MS Access MVP
 
to dhookum: tried the docmd.runcommand but got error:

Run-time error '2046';

The command or action 'SelectRecord' isn't available now.

* You may be in a read-only database or an unconverted database from an earlier version of Microsoft Access.

* The type of object the action applies to isn't currently seleted or ins't in the active view.

Use only those commands and macro actions that are currently available for this database.



I am using Access 97. Do I need to add some library?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top