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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting one field

Status
Not open for further replies.

mru

Technical User
May 26, 2002
20
GB
I have a form with a subform which lists invoices, the majoriy of fields in the subform are locked, the only field which is not locked is the 'payingnow' field, because sometimes this form may contain 100 + invoices and thus alocating group payments can sometimes require a few attempts to get right, I would like to create a select all button which will allow me to delete the data just entered and start again.
I have tried numerous different ways but can't get the button to just select all the ' payinginnow' fields without selecting all the records - when this happens all the invoices are deleted but all I would like to do is delete just the data in the 'payinginnow' column

I hope I've explained this well and that someone may be able to help

Thanks
MRU
 
What you ask makes sense to me.

The way you are going about it is the reason you're having problems.

When you click the button you need to

Open a recordset based on the same criteria that selects the data that appears in the subForm - then
While NOT recSet.EOF
recSet.Edit ' ( Only if using DAO )
recSet!PayingNow = 0
recSet.Update
recSet.MoveNext
Wend



'ope-that-'elps.

G LS
 
Thanks for your reply LittleSmudge

I have tried the code you suggested and can't get it to work, being new to access it is probably me, could you please give me a more detailed explanation as to the code I should write and where it should be placed.

Thanks again

MRU
 
Okay MRU, What version of Access are you working in?
( Are you using DAO or ADO )

Post the table name & field names of the table that is bound to the subform. ( contains the PayingInNow field )

using the structure
Code:
[u]TableName[/u]
[b]PrimaryKey[/b]
OtherFields


Then post the code that you do have


That will help me to know what you need and get the code right for you.

G LS
 
Hi LittleSmudge
I am using DAO and using access 2000

the table name is 'tblPurchaseInvoice'
the table primary key is 'purinvprimkey'
the field names are 'suppidcode' 'purinvdate' 'purinvrefnum'
'purinvdesc' 'purinvcostnet' 'purinvcostvat' 'purinvamountpaid' and 'purinvpayinginnow'
The two other fields are 'purinvtotal' ( this field is the total of the 'purinvcostnet' + 'purinvcostvat' fields) and
'purinvoutstanding' ( this field is the total of the 'purinvcostnet' + 'purinvcostvat' fields less the 'purinvamountpaid' field.

All the fields except the 'purinvpayinginnow' are disabled.

data is supplied via a query named 'PurchasePaymentQuery'

Hope you can follow this, thanks again

MRU
 
WHY ? Why are you still using DAO when you have Access 2k ?


Dim db As Database
Dim rst As Recordset

Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT suppidcode, purinvdate, purinvrefnum, purinvdesc, purinvcostnet, purinvcostvat, purinvamountpaid, purinvpayinginnow FROM tblPurchaseInvoice WHERE clause ")

{clause = The WHERE clause that links the existing Main Form to the SubForm - info I don't have.}

Then the While Loop

rst.Close
End Sub






By the Way, you said :-
The two other fields are 'purinvtotal' ( this field is the total of the 'purinvcostnet' + 'purinvcostvat' fields) and
'purinvoutstanding' ( this field is the total of the 'purinvcostnet' + 'purinvcostvat' fields less the 'purinvamountpaid' field.

All the fields except the 'purinvpayinginnow' are disabled

I don't think you really mean FIELDS here do you?
I hope you mean controls.
If you really mean fields then I've lost the plot !


'ope-that-'elps.

G LS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top