Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 02-16-2012, 07:27 AM   #1
faesce
Newly Registered User
 
Join Date: Feb 2012
Posts: 22
Thanks: 8
Thanked 0 Times in 0 Posts
faesce is on a distinguished road
I just can't figure it out!

I'm sorta new with access when it comes to the programming side of things. From the user side though I'm familiar, so I know what I need done, but am unsure as to how to do it.

Basically what I have is a barcode system setup that when somebody mails a donation to us, I can scan the code and it brings their record up. What I'd like, in order to automate the process, is to create a simple button that fills in the amount sent in (it is 9 times out of 10 the same as the amount requested; this dollar amount is already input on another box in the record, basically need this copied to the "amount paid" box on click of button), as well as the current date needs to be added into a separate Date box. The final thing is we have a checkbox for "collected" that needs to be checked with this button.

How could I go about filling out these two boxes and checking my checkbox with a single button press? This way all we need to do is scan the scanner which brings up the record, then click the button to fill the forms, and move right into the next one.

Any help would be greatly appreciated.

faesce is offline   Reply With Quote
Old 02-16-2012, 10:57 AM   #2
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: I just can't figure it out!

For copying between controls, you just need to refer to the control and set the value of the other control from right to left.
Code:
ControlToBeSet = ControlWithValue
Here's a website re referencing controls:
http://access.mvps.org/access/forms/frm0031.htm

For the date part, use Date() on the right hand side of the equal to sign (as shown above). Or if it's going to happen for new records only, set the Default Value property of the field to Date().

For checkboxes, -1 represents checked and 0 represents not checked.
vbaInet is offline   Reply With Quote
The Following User Says Thank You to vbaInet For This Useful Post:
faesce (08-02-2012)
Old 02-17-2012, 06:24 AM   #3
faesce
Newly Registered User
 
Join Date: Feb 2012
Posts: 22
Thanks: 8
Thanked 0 Times in 0 Posts
faesce is on a distinguished road
Re: I just can't figure it out!

Awesome, thank you much. I'll do some reading and see if I can get it working. Now, is it possible to set the focus on a certain box after that checkbox gets checked? That way it has the right box selected ready for the next scan.

faesce is offline   Reply With Quote
Old 02-17-2012, 02:57 PM   #4
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: I just can't figure it out!

Yes it is. You would use the SetFocus method of the control to move focus to the control. This code will go in the Click event or After Update event of the checkbox. E.g.:
Code:
Me.ControlName.SetFocus
Where ControlName is the name of the control you would like to move the focus to.
vbaInet is offline   Reply With Quote
The Following User Says Thank You to vbaInet For This Useful Post:
faesce (08-02-2012)
Old 03-01-2012, 10:24 AM   #5
faesce
Newly Registered User
 
Join Date: Feb 2012
Posts: 22
Thanks: 8
Thanked 0 Times in 0 Posts
faesce is on a distinguished road
Re: I just can't figure it out!

Alright. I've got it to do what I want. It copies the amount, adds in the date, checks the box, and puts the cursor where I want it. However there's a strange side effect!

The info is being put into the correct boxes and everything, except it doesn't display until after a refresh! i.e. I have to either close the record and re-open it and then it will display in the box, OR I have to click on the box and then it shows up. It seems like the data is in fact going to the right place, its just a display bug? Is there a trick to force it to display instantly when I click my button?

Here's my code:

Private Sub Command94_Click()
tblPledgesLead!PledgeAmountRecd = tblPledgesLead!Custom1
tblPledgesLead!DateRecd = Date
tblPledgesLead!Collected = -1
Me.txtSelectPhone.SetFocus
End Sub
faesce is offline   Reply With Quote
Old 04-13-2012, 05:48 AM   #6
faesce
Newly Registered User
 
Join Date: Feb 2012
Posts: 22
Thanks: 8
Thanked 0 Times in 0 Posts
faesce is on a distinguished road
Re: I just can't figure it out!

Bump. Any idea on how I could get this to show up right away?
faesce is offline   Reply With Quote
Old 04-13-2012, 06:12 AM   #7
tinyevil777
Newly Registered User
 
Join Date: Dec 2010
Location: Wales, UK
Posts: 137
Thanks: 12
Thanked 9 Times in 9 Posts
tinyevil777 is on a distinguished road
Re: I just can't figure it out!

You need to add a "Me.Requery [MyControlName]" for any fields you want to refresh (display the updated data)

__________________
"A beard with an idiot hanging off it"

In February 2013, i am climbing Kilimanjaro to raise money for Nightingale House Hospice. Please visit
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to find out how you can donate. Thank you.
tinyevil777 is offline   Reply With Quote
The Following User Says Thank You to tinyevil777 For This Useful Post:
faesce (08-02-2012)
Old 08-02-2012, 09:44 AM   #8
faesce
Newly Registered User
 
Join Date: Feb 2012
Posts: 22
Thanks: 8
Thanked 0 Times in 0 Posts
faesce is on a distinguished road
Re: I just can't figure it out!

Quote:
Originally Posted by tinyevil777 View Post
You need to add a "Me.Requery [MyControlName]" for any fields you want to refresh (display the updated data)
Hm. This doesn't seem to work. This gives me an invalid arguments error.
faesce is offline   Reply With Quote
Old 08-02-2012, 10:04 AM   #9
bob fitz
AWF VIP
 
Join Date: May 2011
Location: Essex England
Posts: 3,532
Thanks: 52
Thanked 684 Times in 666 Posts
bob fitz has a spectacular aura about bob fitz has a spectacular aura about bob fitz has a spectacular aura about
Re: I just can't figure it out!

Try:
Me.NameOfYourControl.Requery
__________________
Bob Fitzpatrick
Microsoft Community Contributor Award (2011)
If this helped, please click the scales at the bottom left of this posting.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Many thanks.


I have never failed. I have found a thousand ways that do not work!
bob fitz is offline   Reply With Quote
The Following User Says Thank You to bob fitz For This Useful Post:
faesce (08-02-2012)
Old 08-02-2012, 11:00 AM   #10
faesce
Newly Registered User
 
Join Date: Feb 2012
Posts: 22
Thanks: 8
Thanked 0 Times in 0 Posts
faesce is on a distinguished road
Re: I just can't figure it out!

Quote:
Originally Posted by bob fitz View Post
Try:
Me.NameOfYourControl.Requery
What I'm wanting refreshed is both tblPledgesLead!PledgeAmountRecd and tblPledgesLead!DateRecd.

So if I'm understanding correctly, I should have

Me.tblPledgesLead!PledgeAmountRecd.Requery
Me.tblPledgesLead!DateRecd.Requery

This gives a runtime error 438:
Object doesn't support this property or method.
faesce is offline   Reply With Quote
Old 08-02-2012, 11:43 AM   #11
bob fitz
AWF VIP
 
Join Date: May 2011
Location: Essex England
Posts: 3,532
Thanks: 52
Thanked 684 Times in 666 Posts
bob fitz has a spectacular aura about bob fitz has a spectacular aura about bob fitz has a spectacular aura about
Re: I just can't figure it out!

Me.tblPledgesLead!PledgeAmountRecd.Requery
Me.tblPledgesLead!DateRecd.Requery
The bit in red needs to be the name of the control. You can see what that is by looking at the controls "Name" property.
My guess would be that you need:
Me.PledgeAmountRecd.Requery
Me.DateRecd.Requery
__________________
Bob Fitzpatrick
Microsoft Community Contributor Award (2011)
If this helped, please click the scales at the bottom left of this posting.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Many thanks.


I have never failed. I have found a thousand ways that do not work!
bob fitz is offline   Reply With Quote
The Following User Says Thank You to bob fitz For This Useful Post:
faesce (08-02-2012)
Old 08-02-2012, 12:17 PM   #12
faesce
Newly Registered User
 
Join Date: Feb 2012
Posts: 22
Thanks: 8
Thanked 0 Times in 0 Posts
faesce is on a distinguished road
Re: I just can't figure it out!

When I use:

Me.PledgeAmountRecd.Requery
Me.DateRecd.Requery

I get:

Compile error:
Method or data member not found


EDIT:

I got it! What was happening was when I went and viewed the property sheet, the Name was actually different than the Source Object. The person who created this database had PledgeAmountRecd for the source object named as PledgeAmountRec'd and the apostrophe was throwing it off. Same thing for my date field. Now it auto refreshes without needing to requery at all! This is absolutely perfect now!

Hopefully changing the name won't have any adverse effects on anything else.

Thank you all very much, you've been life savers!

Last edited by faesce; 08-02-2012 at 12:24 PM.
faesce is offline   Reply With Quote
Old 08-02-2012, 12:24 PM   #13
bob fitz
AWF VIP
 
Join Date: May 2011
Location: Essex England
Posts: 3,532
Thanks: 52
Thanked 684 Times in 666 Posts
bob fitz has a spectacular aura about bob fitz has a spectacular aura about bob fitz has a spectacular aura about
Re: I just can't figure it out!

Can you attach a copy of the db in A2003 mdb format.
Please remove any sensitive data first.

__________________
Bob Fitzpatrick
Microsoft Community Contributor Award (2011)
If this helped, please click the scales at the bottom left of this posting.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Many thanks.


I have never failed. I have found a thousand ways that do not work!
bob fitz is offline   Reply With Quote
The Following User Says Thank You to bob fitz For This Useful Post:
faesce (08-02-2012)
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't figure this out... Zippersabrat Modules & VBA 2 12-04-2011 04:49 PM
[SOLVED] Maybe someone can figure this out. In_Flames Forms 1 06-30-2006 07:35 AM
Can't figure this one out... ... ... vangogh228 The Watercooler 9 12-13-2005 04:55 AM
Cant Figure this out harkonnen Tables 3 01-09-2004 04:05 AM
Please figure this out for me.... Rogue Programme Reports 0 07-16-2003 03:45 AM




All times are GMT -8. The time now is 02:49 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World