UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Fill A Field On A Subform    
 
   
Araman
post Jan 16 2011, 06:04 PM
Post #1

UtterAccess Enthusiast
Posts: 87



I currently have a single form that when i fill in a date and press a button the receive field will populate the received field from the box where i enter the date. I want to move the data to a subform while the main form still has the controls. This is the code that works when it is a single continuous form. attached is a screen shot of the form and subform that i would like to use

Private Sub Command22_Click()
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
Do Until rs.EOF
rs.Edit
rs!Received = Me.Text20
rs.Update
rs.MoveNext
Loop


End Sub

Thanks
Attached File(s)
Attached File  notreceived.png ( 77.35K ) Number of downloads: 22
 
Go to the top of the page
 
+
theDBguy
post Jan 16 2011, 07:24 PM
Post #2

Access Wiki and Forums Moderator
Posts: 47,917
From: SoCal, USA



Hi,

To convert your code from updating the main form to work for a subform, try modifying this line from:

Set rs = Me.RecordsetClone

to:

Set rs = Me.SubformContainerName.Form.RecordsetClone

Hope that helps...
Go to the top of the page
 
+
Araman
post Jan 16 2011, 08:15 PM
Post #3

UtterAccess Enthusiast
Posts: 87



Thank you..... I don't see how i missed that one....been working too many hours on this one (IMG:style_emoticons/default/smile.gif)

Thanks Again
Go to the top of the page
 
+
Araman
post Jan 16 2011, 08:37 PM
Post #4

UtterAccess Enthusiast
Posts: 87



Hello, Question...
It works the first time but i must close the form and go back in to it to do it again. any thoughts

This post has been edited by Araman: Jan 16 2011, 08:46 PM
Go to the top of the page
 
+
theDBguy
post Jan 17 2011, 03:00 PM
Post #5

Access Wiki and Forums Moderator
Posts: 47,917
From: SoCal, USA



Try adding these after the Loop:

rs.Close
Set rs = Nothing

Hope that helps...
Go to the top of the page
 
+
Araman
post Jan 19 2011, 08:23 AM
Post #6

UtterAccess Enthusiast
Posts: 87



Hello,

I get an error when i go to reset the date field for a new batch. Included is a screenshot of it.

Thanks
Attached File(s)
Attached File  receive.png ( 13.64K ) Number of downloads: 8
 
Go to the top of the page
 
+
theDBguy
post Jan 19 2011, 11:58 AM
Post #7

Access Wiki and Forums Moderator
Posts: 47,917
From: SoCal, USA



Hi,

Can you post your updated code? Also, have you tried using Recordset instead of RecordsetClone?
Go to the top of the page
 
+
Araman
post Jan 19 2011, 05:57 PM
Post #8

UtterAccess Enthusiast
Posts: 87



Hello. I tried using recordset and the subform has the #name error in the fields

this is the code

Private Sub Command22_Click()
Dim rs As DAO.Recordset
Set rs = Me.frmNotReceivedSub.Form.RecordsetClone
Do Until rs.EOF
rs.Edit
rs!Received = Me.Text20
rs.Update
rs.MoveNext
Loop

rs.Close
Set rs = Nothing



End Sub
Go to the top of the page
 
+
theDBguy
post Jan 20 2011, 09:54 AM
Post #9

Access Wiki and Forums Moderator
Posts: 47,917
From: SoCal, USA



Hi,

QUOTE (Araman @ Jan 19 2011, 02:57 PM) *
I tried using recordset and the subform has the #name error in the fields

Did you mean you already tried it this way?

Set rs = Me.frmNotReceivedSub.Form.Recordset


QUOTE
this is the code

Private Sub Command22_Click()
Dim rs As DAO.Recordset
Set rs = Me.frmNotReceivedSub.Form.RecordsetClone
Do Until rs.EOF
rs.Edit
rs!Received = Me.Text20
rs.Update
rs.MoveNext
Loop

rs.Close
Set rs = Nothing



End Sub

If you did try it as a Recordset and not RecordsetClone, you might consider posting a zipped up version of your db because I can't really tell what's wrong with your code.

Just my 2 cents...
Go to the top of the page
 
+
Araman
post Jan 20 2011, 09:45 PM
Post #10

UtterAccess Enthusiast
Posts: 87



The Code works as it suppose to. I'm wondering if the the form itself needs to be reset, refreshed or something like that after the code runs
Go to the top of the page
 
+
theDBguy
post Jan 21 2011, 11:56 AM
Post #11

Access Wiki and Forums Moderator
Posts: 47,917
From: SoCal, USA



Hi,

I don't see any harm in trying. Let us know how it goes...
Go to the top of the page
 
+
Araman
post Jan 22 2011, 08:29 AM
Post #12

UtterAccess Enthusiast
Posts: 87



Ok here it is. the form in question is under the edit tab amd is receive orders

Thanks

This post has been edited by Araman: Jan 22 2011, 08:38 AM
Attached File(s)
Attached File  Database.zip ( 1.44MB ) Number of downloads: 14
 
Go to the top of the page
 
+
theDBguy
post Jan 22 2011, 10:34 AM
Post #13

Access Wiki and Forums Moderator
Posts: 47,917
From: SoCal, USA



Hi,

I got a "Unrecognized database format" error when I tried to open your file. Are you using Acc2010?
Go to the top of the page
 
+
Araman
post Jan 22 2011, 11:17 AM
Post #14

UtterAccess Enthusiast
Posts: 87



yes, with the new navigation system
Go to the top of the page
 
+
Araman
post Jan 22 2011, 11:44 AM
Post #15

UtterAccess Enthusiast
Posts: 87



i can up the original done 2 years ago in access 2007. It's 2 files as it is split when in use. it has the same issue as far as only 1 mass update then i must close the form . although i do not get the error i showd earlier.

This post has been edited by Araman: Jan 22 2011, 11:47 AM
Go to the top of the page
 
+
theDBguy
post Jan 22 2011, 11:47 AM
Post #16

Access Wiki and Forums Moderator
Posts: 47,917
From: SoCal, USA



No, that's okay. I'll just have to wait 'till I can download your db on a 2010 machine (unless somebody else beats me to it).

Later...
Go to the top of the page
 
+
Araman
post Jan 22 2011, 11:55 AM
Post #17

UtterAccess Enthusiast
Posts: 87



thanks
Go to the top of the page
 
+
theDBguy
post Jan 27 2011, 12:25 AM
Post #18

Access Wiki and Forums Moderator
Posts: 47,917
From: SoCal, USA



Hi,

Just want to give you an update, sorry for the delay but I probably won't be able to get to an Acc2010 machine until this weekend. I hope I am not causing you any problems with this delay.
Go to the top of the page
 
+
Araman
post Jan 27 2011, 11:53 AM
Post #19

UtterAccess Enthusiast
Posts: 87



No, Not at all. It was a bug with the last version also, just never realized it so it's no big deal. i've made a lot of change since the upload as so far as table normilization but that should have no effect on the issue at hand or its resolution.

Thanks

This post has been edited by Araman: Jan 27 2011, 11:54 AM
Go to the top of the page
 
+
theDBguy
post Jan 29 2011, 12:16 PM
Post #20

Access Wiki and Forums Moderator
Posts: 47,917
From: SoCal, USA



Hi,

I was finally able to download your db. If you see this post today, could you please give me a step-by-step on how to duplicate your issue? Thanks.
Go to the top of the page
 
+

2 Pages V   1 2 >
Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 10:38 AM