473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Continued Problems on Subforms

OK, next question :) Once the form sub sub form is open I am trying to update a table based on a double click selection. - employee may have multiple claims, they need to select one to attach charges to by double clicking one of the records in the opened sub form. I have been trying to get the following to work. (forum is wrapping the lines)
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_DblClick(Cancel As Integer)
  2.  
  3. Dim stSQL As String
  4. stSQL = "UPDATE UCT_Data SET UCT_Data.pkUnemploymentDataID = " & Me.pkUnemploymentDataID & ", UCT_Data.CreateFile = 'Yes' WHERE UCT_Data.UCT_Data_ID = " & Forms.UCT_Data_sub.UCT_DATA_ID & ";"
  5. DoCmd.SetWarnings False
  6. MsgBox stSQL
  7. 'DoCmd.RunSQL stSQL
  8. DoCmd.SetWarnings True
  9.  
  10. End Sub
but the WHERE clause is blowing it up. Any ideas?
Nov 16 '09 #1
5 1496
I believe the problem lay in the fact that I was referenceing the parent form in the where clause. I modified the Query that feeds the subform to carry the necessary key along to the subform and it seems to be working now.
Nov 16 '09 #2
NeoPa
32,556 Expert Mod 16PB
OK. It seems there are a number of things to say here if we are to proceed in a positive manner.
  1. I've moved this new question from an earlier thread (Problem opening subform when double click record from main form). Multiple questions in the same thread can make sense sometimes. Not ideal but less complicated sometimes than the alternatives. This is not one of those times. The preferred way to do it is to keep each thread for its own question (as per the site rules Posting Guidelines).
  2. I have edited three of your posts just today because they have included code without the CODE tags. I commented each one, yet you seem to have failed to notice this when looking for our help. Please note this for all future posts.
  3. Your latest question posts a line of code that creates some SQL, but it neither displays the resultant SQL (something I just suggested would be a first step to help understand what's going wrong), nor is it formatted in such a way as to be readable without scrolling the page.

    Your own coding style is a matter for you of course, but when posting to request help it would be less inconsiderate if you formatted your code at least legibly for the medium. This assumes of course that you are aware of continuation characters in VBA and/or the ability to create a string over multiple lines using concatenation. If not then say so, as that would be a different position. We could help with that of course.
Nov 16 '09 #3
NeoPa
32,556 Expert Mod 16PB
Having said all that, it seems your problem is to do with referring to the item (control) on your form.

I would expect the following to work better for you :
Expand|Select|Wrap|Line Numbers
  1. stSQL = "UPDATE UCT_Data " & _
  2.         "SET [pkUnemploymentDataID]=" & Me.pkUnemploymentDataID & ", " & _
  3.             "[CreateFile]='Yes' " & _
  4.         "WHERE [UCT_Data_ID]=" & Me.UCT_Data_sub.UCT_DATA_ID & ";"
This is without your actually explaining where this control fits in overall though, so if this doesn't work, describe that and we can look at a solution that will work.
Nov 16 '09 #4
Sorry for the bad form, I did not know about using the Coding tags, I will do so in the future. Based on your example, I also now know how to break and concatenate lines in vba, it is frustrating in that the syntax is close to the .net version of vb I am used to, but different enough that nothing seems to work (you use an underscore _ to indicate the end of line, but do not need to include the ampersand in .Net, the system just knows) I apologize again for my elementary mistakes, This is my first real advent into programming a GUI in ACCESS and vba.
Nov 16 '09 #5
NeoPa
32,556 Expert Mod 16PB
In that case there's nothing to worry about.

Some posters are a lot more trouble of course ;)

Welcome to Bytes!
Nov 16 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JJMM | last post by:
Hi, I have a form (form1) with a large number of subforms inside it (around 20 subforms), There is the possibility of filtering the data using a pop-up form that create/change a query (all the...
3
by: Evil | last post by:
Hi, i have a problem with a treeview and some subforms in MS Access97. I have a form with a treeview on the left side which lets me navigate thru some projects. Then on the right side, i have...
1
by: M Wells | last post by:
Hi All, I am developing an Access 2003 project application with the back end in SQL Server 2003. I have a master form that tracks projects, and several subforms on it that track various...
2
by: Jack | last post by:
Hi all, I searched the archives and found everyone happy with Stephen's MouseWheel On/Off code except for those with subforms. Stephen's page indicates that he has added code to handle subforms...
0
by: Jack | last post by:
Gday everyone, I'm dearly hoping Stephen Lebans is going to update his masterpeice to stop the mouse wheel scrolling to work on subforms *he has indicated this to me but of course beggers can't...
5
by: Richard Stanton | last post by:
Hello all My database has a main form linked to table1. It has several subforms on the main form, all linked to table2. Table1 and Table2 are linked by primary/foreign key, no duplicates...
3
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality...
4
by: Harlequin | last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase...
1
by: tmh86 | last post by:
I am currently building a database within Access 2007. I have a form that is populated via vba coding and thereform is not stored in a specific table. I have created a button that essentially runs...
3
by: sara4 | last post by:
I have a form with 2 subforms on it. The 2 subforms have a table-valued function as their recordsource and the input parameters property that 'reads' the parameter values (field values) from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.