 |
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

February 14th, 2008, 01:15 PM
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Camehere,
Do you have the code behind the commandbutton?
dartcoach
|

February 14th, 2008, 01:15 PM
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
What does the code currently look like? If you are using checks to check the records you want to see the history of, then I would use a query string where Check = Yes, like:
"SELECT * FROM tblHistory WHERE MyCheck = Yes"
This assumes that the check boxes are bound, and there is a check field in each record.
Then after the report runs, run an update query that sets all the checks to No so that the form is cleared.
mmcdonal
Look it up at: http://wrox.books24x7.com
|

February 14th, 2008, 08:51 PM
|
Authorized User
|
|
Join Date: Feb 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you for all your replies
My code for the commandbutton is something like that. It only shows up the History of the Part which the cursor is resting at.
And History of all selected parts have to show up in a form.
stDocName = "frmHistory"
stLinkCriteria = "[PartsID]=" & "'" & Me![PartsID] & "'" _
& "Chkbox=" & "'" & True & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
|

February 14th, 2008, 09:27 PM
|
Authorized User
|
|
Join Date: Feb 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Or something like that?
stDocName = "frmHistory"
stLinkCriteria = "[PartsID]=" & "'" & MouldPartsDetails![PartsID] & "'" _
& "In (Select PartsID From MouldPartsDetails Where Chkbox = True)"
DoCmd.OpenForm stDocName, , , stLinkCriteria
|

February 15th, 2008, 05:21 AM
|
Authorized User
|
|
Join Date: Feb 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey I got the part on the opening History of selected part, I used Query.. but I need to reset checkbox to false... any advices?
|

February 15th, 2008, 10:04 AM
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Create an Update Query that sets all the check boxes to False / No, then do this in your code:
DoCmd.SetWarnings False
DoCmd.OpenQuery "MyUpdateQuery"
DoCmd.SetWarnings True
mmcdonal
Look it up at: http://wrox.books24x7.com
|

March 4th, 2008, 01:27 PM
|
Authorized User
|
|
Join Date: Feb 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Table A: PartName, Code
Table B: PartName, Date
My FormB is created based on Table B fields, recordsource of form is from Table B. I need to add another textbox and its controlsource should be 'code' in Table A. I am not using subform. how should the SQL for controlsource be like?
Thanks.
|

March 4th, 2008, 01:50 PM
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
It should look like this:
Table A:
PartID - PK
PartName
Table B:
CodeID - PK
PartID - FK
Code
Date
This will get you what you want and make it updateable.
Alternatively, you can create an unbound ListBox (not sure if this is one to one, or one to many), and then display the value using the On Current event of the form and a Me.ListBox.Recordsource = "SELECT [Code] FROM TableA WHERE [PartName] = '" Me.PartName kind of thing.
This will DISPLAY the data, but you can't update it without adding more code, and perhaps another button to update the field.
Did that help?
mmcdonal
Look it up at: http://wrox.books24x7.com
|

March 4th, 2008, 09:40 PM
|
Authorized User
|
|
Join Date: Feb 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry I am very bad at Accessâ¦
For my TableA, each partname has a unique Code number. And my code is tied to the partname, fixed and needs not be changed My tableB, has comboboxes partname and date. FormB is based on TableB. A textbox has been added at each record , which I want it to appear as code, matched by the partname in TableA, where partname is same as combobox partname.
Whenever I change combobox partname in a record, the textbox showing code should change accordingly.
I tried setting SELECT [Code] FROM TableA WHERE [Partname] = Me.combo64 in the property setting controlsource
|
|
 |