subform problems 06-12-07

Does anyone know how to make a button on the mainform delete the records 
showing on its subform which is in datasheet view? Thanks for the help!
-- 
Michael
0
Utf
6/12/2007 4:26:02 PM
access.forms 6864 articles. 2 followers. Follow

4 Replies
686 Views

Similar Articles

[PageSpeed] 11

Create a query based on the table or query that is the rowsource of the 
subform. The query should include the Linkchild field of the subform. Set 
the criteria of that field to:
Forms!NameOfMainForm!NameOfLinkMasterfieldOfSubform
Change the query to a delete query. Create a button on the main form and in 
the On Click event open the query.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@pcdatasheet.com



"Michael" <Michael@discussions.microsoft.com> wrote in message 
news:EE176767-838F-4820-9F48-201E5B1865C0@microsoft.com...
> Does anyone know how to make a button on the mainform delete the records
> showing on its subform which is in datasheet view? Thanks for the help!
> -- 
> Michael 


0
Steve
6/12/2007 4:36:27 PM
Well, that might work, but for what I am trying to do, I would have thought 
there would be an easier route. I probably didn't explain my situation well 
enough. Basically what is happening is the user is allocating inspected 
inventory to three locations (corresponding to three subforms). Depending on 
what the company wants to do with this inventory, all, one or just two of the 
subforms may be used. When they are filling them out and say for instance 
they started inputting information in the wrong one of the three subforms 
(remember the forms are in datasheet view), I want them to be able to have a 
button that clears the subforms and let them start again. I don't want to 
have them have to learn to click in the margin and hit the delete button to 
delete the records. Thanks for your help Steve!
-- 
Michael


"Steve" wrote:

> Create a query based on the table or query that is the rowsource of the 
> subform. The query should include the Linkchild field of the subform. Set 
> the criteria of that field to:
> Forms!NameOfMainForm!NameOfLinkMasterfieldOfSubform
> Change the query to a delete query. Create a button on the main form and in 
> the On Click event open the query.
> 
> PC Datasheet
> Providing Customers A Resource For Help With Access, Excel And Word
> Applications
> resource@pcdatasheet.com
> 
> 
> 
> "Michael" <Michael@discussions.microsoft.com> wrote in message 
> news:EE176767-838F-4820-9F48-201E5B1865C0@microsoft.com...
> > Does anyone know how to make a button on the mainform delete the records
> > showing on its subform which is in datasheet view? Thanks for the help!
> > -- 
> > Michael 
> 
> 
> 
0
Utf
6/12/2007 5:14:02 PM
Forgot to add that I just want them to delete what is currently in the 
datasheets, not all the records that the datasheets write into.
-- 
Michael


"Steve" wrote:

> Create a query based on the table or query that is the rowsource of the 
> subform. The query should include the Linkchild field of the subform. Set 
> the criteria of that field to:
> Forms!NameOfMainForm!NameOfLinkMasterfieldOfSubform
> Change the query to a delete query. Create a button on the main form and in 
> the On Click event open the query.
> 
> PC Datasheet
> Providing Customers A Resource For Help With Access, Excel And Word
> Applications
> resource@pcdatasheet.com
> 
> 
> 
> "Michael" <Michael@discussions.microsoft.com> wrote in message 
> news:EE176767-838F-4820-9F48-201E5B1865C0@microsoft.com...
> > Does anyone know how to make a button on the mainform delete the records
> > showing on its subform which is in datasheet view? Thanks for the help!
> > -- 
> > Michael 
> 
> 
> 
0
Utf
6/12/2007 5:18:01 PM
Once you move of a record in a datasheet, the record is saved to the table. 
Thus to delete the records that were saved you have to delete them from the 
table. However, if you are entering a new record, the record has not been 
saved yet. So to remove the record from the datasheet, you can undo it. It 
seems to me that to give you control over what gets removed and deleted, you 
need a button on each subform. To delete records that have already been 
saved you need three Delete queries as I previously described. You also need 
to be able to remove unsaved records so you need to execute the Undo action 
in your code. So your code in the click event of each button needs to look 
like:
Me.Undo
Code to execute Delete query

Records in a subform are only those related to the record in the main form 
through the LinkMaster/Linkchild relationship. When you go to a new record 
in the main form, a new set of records related to that record should appear 
in the subform. The criteria described in my previous response will keep 
from deleting all the records in the table which is the recordsource of your 
subform.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@pcdatasheet.com





"Michael" <Michael@discussions.microsoft.com> wrote in message 
news:39B5B41E-B787-4183-B8D1-E9E2515906BA@microsoft.com...
> Forgot to add that I just want them to delete what is currently in the
> datasheets, not all the records that the datasheets write into.
> -- 
> Michael
>
>
> "Steve" wrote:
>
>> Create a query based on the table or query that is the rowsource of the
>> subform. The query should include the Linkchild field of the subform. Set
>> the criteria of that field to:
>> Forms!NameOfMainForm!NameOfLinkMasterfieldOfSubform
>> Change the query to a delete query. Create a button on the main form and 
>> in
>> the On Click event open the query.
>>
>> PC Datasheet
>> Providing Customers A Resource For Help With Access, Excel And Word
>> Applications
>> resource@pcdatasheet.com
>>
>>
>>
>> "Michael" <Michael@discussions.microsoft.com> wrote in message
>> news:EE176767-838F-4820-9F48-201E5B1865C0@microsoft.com...
>> > Does anyone know how to make a button on the mainform delete the 
>> > records
>> > showing on its subform which is in datasheet view? Thanks for the help!
>> > -- 
>> > Michael
>>
>>
>> 


0
Steve
6/13/2007 4:38:59 AM
Reply:

Similar Artilces:

Challenging Problem
OK Guys, I am stumped here once again. I am trying to figure out how to look up formats on another worksheet and paste the format (color) to my current table ONLY if there's a match. This is the match that I have, but I only want it to implement the color of the cell, and not the value, and only to do so if there's a match and not otherwise. =LOOKUP(C$5,'\\Srvr1\Users\ProdCtrl\Schedulers\[8WeekForecast-Color]Result.xls'!$C$3:$IT$3,'\\Srvr1\Users\ProdCtrl\Schedulers\[8WeekForecast-Color]Result.xls'!$C4:$IT4) Anyone have any direction on what the vb code would look l...

CRM Exchange Router 05-26-06
Hello, I am using CRM 3.0 and installed router services on exchange 2003 machine. During installation of router i had created crm@domain.com user in AD and added to crm mailbox now i want to deploy rule so that router sends incoming mails on support@domain.com to CRM (and creates activity in crm) Can anybody guide me, how can i acheive this? I will appreciate any help :-) thanx & regards, Here you go: 1. Settings >> Business Units >> Queues >> create a Queue with email matching support@domain.com 2. Perform the Microsoft CRM Rule Deployment wizard on the Que...

Primary Contact 09-17-07
Is there a way to create primary contacts for multiple accounts at the same time? I did a bulk import of accounts and a bulk import of contacts where the contact's partentcustomerid (Parent Customer) was imported. There is an existing relationship between the contact and the account through the parentcustomerid but I would like to associate the contact as the primary contact for the account. Primary Contact is assigned by mapping the ContactId (GUID) to the Primary Contact field (just like you did for ParentCustomId to get the Parent Account). But of course, this is a double edged ...

Exchange 5.5 Backup problem with Arcserve Backup v9
I just installed Arcserve Backup Agent for Exchange on my NT sp6 with exchange 5.5 sp4. The base product was installed on the backup server (win2k) with the tape drive. I scheduled a backup on the backup server, to backup the Exchange 5.5 server. It failed with error message: "Invaild username or password was submitted". I was not prompted for username or password when scheduling the backup job. Any idea will be appreciated. WS wrote: > I just installed Arcserve Backup Agent for Exchange on my NT sp6 with > exchange 5.5 sp4. > The base product was installed on the backu...

Problem of DGV multi-row selection
Hi everyone I have a problem of DataGridView's multi-row selection behavior. When holding the ctrl key down and DGV's selecttionmode had set to FullRowSelect, user could select multiple rows by click on those rows. And, when user click on a row which already had been selected the row would been deselected. The problem is this select/deselect is based on "mouse down" event instead of "mouse click" event, I mean even before user release the left key the row already had been selected/deselected, which is not an ideal behavior to initialize a drag dro...

hallo 10-14-07
Test ...

Urgent Send email problem!!!
OK Techies; this is a baffler! Neither Netscape-7.1 nor Outlook-2000 send emails from my desktop. I can receive from any email client but can't send from the client. I can send form my ISP's Webserver, but not from my desktop client. I'm using Verizon DSL. Everything else (HW / SW) on the PC works fine; P-3 1 GHz. w/512 Mb. RAM - 80 Gb HD; running Win2k-Pro SP4. It seems as though port 25 (SMTP) is blocked somehow. I tried another DSL modem; no change.It's obviously not the modem, or is it the email client-app (I've used several). I've tried sending with and...

Problem with Conditional format deletion
I have the followint formula in a conditional format. =ROW()=ROW(INDIRECT(CELL("address"))) I remember getting it from this group, it highlights the active cell in yellow. I cannot delete it and I believe it will not allow me to copy and paste data about the spreadsheet. I need to delete as I need to copy and paste more than I need the active cell highlighted. Hi if you want to highlight always the active cell you need VBA. See: http://www.cpearson.com/excel/excelM.htm#HighlightActiveCell -- Regards Frank Kabel Frankfurt, Germany <mark@southwestconst.com> schrieb im Newsbei...

Problem with ifstream
Hello I am using the fstream.h header included with Visual C++ .NET 2003. I create an object of the type ifstream which I use the function load to load a file into the stream. Now what function can be used to tell me when the end of file has been reached? Thanks in advance Sincerely James Simpso Straightway Technologie http://www.straightwaytech.com ...

Permissions problem
After I have created a user, that user is unable to create a profile unless they are a member of the Domain Admins group. The error that is returned is "The name could not be resolved. The bookmark is not valid." I believe the bookmark it is referring to is returned by ADO when the program is trying to access the Active Directory, but I'm not certain. I think it is a problem with the permissions, but I don't know where to look. Any help? SBS2003, Exchange2003 ...

Problems with MFC using CAsyncSocket::
Snippet from my code. Being a client connected to a Server, I have 3 member functions below to use. OnClose, OnConnect and OnReceive. If I were to loose the connection to the server I have no knowledge of it. Any ideas, how I can get notified when I loose my connection to the Server? Also, when I poll the "sock.m_SockStatus" it doesn't give me an error as well. Beging a newbie at this, any help is surely appreciated. Thanks! JT //////////////////////////////////////////////////////////////////////////// / // mysock member functions void mysock::OnClose(int nErrorCode) { ...

Font problem in property Sheet
I am working on a project, in whihc i am using the propertysheet. I am using bitmap(bilbilt) as backgrpound in each of dialog of property sheet. When i am running the application in English US OS it is working fine but in case of japanese OS the back groud image(bitmap)is not coming correctlty. I think this is font problem, Because default font is change from US OS to Japanese. Because of font change dialog width is increasing and height is decreasing. How we can stop to increase in Width and Decrease in height. Essentially, while you can, it is a Really Bad Idea. Using bitmaps as backgr...

outlook 07
When I open outlook(email)and click on tools,then options, the options dialog box does not open fully as to make changes etc. Top right of box just shows red x and blue question mark with no way to expand.windows 7 op.sys.I've tried reloading office but no luck. Please help. ...

Norton Internet Security 2010 compatibility problem?
I'm having assorted problems with both Windows Live Mail (current version) and Windows Mail; some information from a Norton/Symantec chat technician indicates that WLM is not compatible with NIS 2010 and WM is not fully compatible. I only installed NIS 2009 after seeing information that is known to be compatible with WM, and assumed that upgrading to NIS 2010 and/or installing WLM would not cause any new problems. Should this assumption be revised? Robert Miles I use Windows Security Essentials. The technician is not correct. NIS 2010 is not compatible with WLM. ...

problem in saving folder as .onepkg in ON2010(beta)
First of all as a fresh member I'd like to shout BIG Hello to everyone in this busy forum! Now to my first question. After installation of onenote 2010beta I decided that instead of converting all my folders I will make a grand overhaul of them. Thus I moved most of my sections from old folders into a one new folder (2010 compatible). So I did as I planned without any difficulty. The cherry on my ice cake was going to be a creation of extra backup - independent of the default one (you know just in case :wink:). After choosing option 'save as' to Onenote Package (onepkg)...

problem opening excell
When I go to open excell, windows installer starts. It then prompts that I need Windows Office 2000 CD. I have Windows XP on my computer and do not have a Windows Office CD. What do I do? Hi see: http://support.microsoft.com/default.aspx?scid=kb;en-us;265194 -- Regards Frank Kabel Frankfurt, Germany MikeH116 wrote: > When I go to open excell, windows installer starts. It > then prompts that I need Windows Office 2000 CD. I have > Windows XP on my computer and do not have a Windows > Office CD. What do I do? ...

Vlookup problem #4
Hi I have a set of data where colum A has a lerner Name Column B has the different units that learner is enrolled for Example English, Maths, Physics, Biology (Max 4 units for each learner). Column C has marks for each unit. So one learner can have 4 Rows and 3 columns, now when i want to lookup function, I want it to lookup for a learner Garry and find his marks in each unit. How can i do it? Please help, it will be much appriciated.! Thanka Does sorting the data by learning bring up the results you're looking for? "Garry" wrote: > Hi > I have a set of data where c...

Installer Cleanup Utility problems
Running XP Pro SP3 and Office SR-1 Premium. After installing then uninstalling a buggy program, Office advised "This program must be installed to run...etc." Initially I tried Add/Remove Programs-Change-Repair and Re-install, but no change. The date of last use is reflected as 08/02/2008! Then Installer warned "The patch package could not be opened...". After reading kb and forum info, downloaded and installed Installer Cleanup Utility msicuu2.exe. During installation the following errors occur: Internal Error 2908. {121634B3-2F4A-11D3-ADA3-00C04F52DD52} In...

OWA2003 server side rule problem
Hi there, Exchange 2003 running on W2K3 server with BE & FE, BE is also runs AD. Now via FE's OWA, I login & create rule there to auto fwd "send only to me" emails to my personal pop3 mailbox. I found that when exchange receive emails, it did auto fwd a copy out, however my personal pop3 mailbox never receive it. From ESM msg tracking, it said at backend server, date/time SMTP Store Driver: Message Submitted from Store date/time SMTP: Message Submitted to Advanced Queuing date/time SMTP: Started Message Submission to Advanced Queue date/time SMTP: Message Submitted ...

Chart printing problem.
I have a bar chart. It has 25 bars in 2 pages. I tried to print the chart. then i faced one problem. it is not printing properly.. One bar which is positioned at bottom of the 1st page is getting cut in the 1st page. And again its printed completed on the 2nd page.. I want to print this bar, either it shuld come on the first page or the second page.. I created this chart dynamically. Is any solution is there for solve this problem. Please help me. Thanks. Ram Kumar.R. -- ramkumar_cpt ------------------------------------------------------------------------ ramkumar_cpt's Profile: htt...

Problem with Advanced Find
>Hello, any help would be very much appreciated. >On our original hard drive, all Microsoft outlook related >folders were located in the single file "mailbox.pst" >The hard drive encountered a virus, and the most recently >backed up "mailbox.pst" that wasn't infected, was copied >onto our new hard drive. >After loading outlook, onto the new hard drive, a whole >new set of "personal folders" was created. We then opened >the old "mailbox.pst"( by pressing File->open), and the >old folders appeared above the new p...

Can't prevent updates and allow new records on form/subform/subfor
I have a form with a subform that also contains a subform. The Data Entry property for each is set to No. I would like to prevent users from updating records on each form, but I would also like to allow them to create new records on each form. To achieve this, I set the Allow Edits property to No on each form, while retaining the Yes setting for Allow Additions and Allow Deletions. The result is that I can create new records on the main form, but not on either subform. Am I stuck with this, or am I doing something wrong? Thanks!!! Yes, that is how Access works. If you set AllowEd...

Excel Problem #14
Column A Column B Column C Column F Column G Column H DATE PRODUCT QTY DATE PRODUCT QTY Oct 05 Apples 2 Oct 03 Orange 1 Oct 10 Candy 1 Oct 03 Cookies 5 Oct 03 Grapes 3 Oct 07 Apples 6 Oct 03 Orange 1 QUESTION? Extract all "OCT 03" dates put on "Column F", "PRODUCT" put on "Column G", "QTY" put on "Column H" by us...

Re: Access 2007 05-20-07
U�ytkownik ">" <Jan Kowalski <Tutaj wpisujesz �w�j nick> napisa� w wiadomo�ci news:... > > > -- > msnews.microsoft.com > Uzytkownik "Michael" <mmatuszak@comcast.net> napisal w wiadomosci > news:1172517310.689465.209590@z35g2000cwz.googlegroups.com... >> The reason I ask is that I, too, work with a highly programmed Access >> database (some 15,000 lines of VBA code, much of it automating data >> entry on forms -- and believe me, it's very tight code). In Access 97, >> 2000, 2002, and 2003, no performance pr...

Problem with Filegroups and Indexes
Hi all I have two filegroups (DATA and INDEX). I create a new table on filegroup DATA and a PrimaryKey Constraint (NONCLUSTERED) on filegroup INDEX. This works fine, the table is on filegroup DATA and the Index on filegroup INDEX. When I now add a clustered Index (to filegroup INDEX), the filegroup of the table is changed to INDEX ... Does somebody know why this happens ?? Thanks a lot and best regards Frank Uray Hi Frank The leaf level of a clustered index IS the data. You cannot have a clustered index separate from the data, so wherever you build the clustered inde...