Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / October 2008

Tip: Looking for answers? Try searching our database.

Function works erratically

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dudley - 08 Oct 2008 19:38 GMT
I have a function in Access 2000 which is called by F6 as follows:

Public Function BonaFideFormation()
Forms![Enquiries]![Type] = "FORMB"
Forms![Enquiries]![Price] = "£77.97"
Forms![Enquiries]![Non VAT] = "£15"
Forms![Enquiries]![VAT] = "£11.03"
Forms![Enquiries]![Price inc VAT] = "£89"
Forms![Enquiries]![Note] = "VAT not charged on £15 official fee"
DoCmd.GoToControl "Order Date"
End Function

Type and Note are text fields and the rest are currency fields (apart from
Order Date). If I press F6 without entering data into a record the function
works, but if I first enter data in other fields (ie not ones included in the
function) and then press F6, the function works for the text fields but not
for the currency ones. Can anyone tell me why and how I solve the problem?

Thanks
Dudley
Douglas J. Steele - 08 Oct 2008 19:53 GMT
Presumably your currency fields are Price, Non VAT, VAT and Price inc VAT.

Assuming that they're bound to Currency fields in your table, remove the
quotes and the pound signs:

Public Function BonaFideFormation()

 Forms![Enquiries]![Type] = "FORMB"
 Forms![Enquiries]![Price] = 77.97
 Forms![Enquiries]![Non VAT] = 15
 Forms![Enquiries]![VAT] = 11.03
 Forms![Enquiries]![Price inc VAT] = 89
 Forms![Enquiries]![Note] = "VAT not charged on £15 official fee"
 Forms![Enquiries]![Order Date].SetFocus

End Function

Note, too, that I replaced your GoTo statement with SetFocus.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I have a function in Access 2000 which is called by F6 as follows:
>
[quoted text clipped - 19 lines]
> Thanks
> Dudley
Dudley - 08 Oct 2008 20:37 GMT
Thanks for your help. However, I have replaced my function as you advise with
copy and paste and I still have the same problem.

Regards
Dudley

> Presumably your currency fields are Price, Non VAT, VAT and Price inc VAT.
>
[quoted text clipped - 38 lines]
> > Thanks
> > Dudley
Douglas J. Steele - 09 Oct 2008 12:09 GMT
What happens if you open the Immediate Window (Ctrl-G) and type, say,

Forms![Enquiries]![Price] = 77.97

then hit Enter? Does the field in the form get updated?

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Thanks for your help. However, I have replaced my function as you advise
> with
[quoted text clipped - 49 lines]
>> > Thanks
>> > Dudley
Dudley - 09 Oct 2008 16:15 GMT
Yes it does, and I have found that the fields are updated if I exit the
record and return to it. I have thus found that this works:

Public Function StandardFormation()
Forms![Enquiries]![Type] = "FORM"
Forms![Enquiries]![Price] = 77.97
Forms![Enquiries]![Non VAT] = 15
Forms![Enquiries]![VAT] = 11.03
Forms![Enquiries]![Price inc VAT] = 89
Forms![Enquiries]![Note] = "VAT not charged on £15 official fee"
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acPrevious
DoCmd.GoToControl "Order Date"
End Function

Thanks very much for all your help.

Dudley

> What happens if you open the Immediate Window (Ctrl-G) and type, say,
>
[quoted text clipped - 55 lines]
> >> > Thanks
> >> > Dudley
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.