473,396 Members | 1,968 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,396 software developers and data experts.

Help....Frustrated with Forms

Hello all.

Briefly described this is the problem I am having. I have a form, with
a related subform. On the subform I want to enter the expiration date
based on criteria in the main form. I have tried placing code in the
on exit event and the after update event with no luck. Please take a
look at the code and let me know what you think. Oh yeah..... I can
get this to work without using the main forms criteria ........ I
tried doing a Dlookup for this information dimming it as a variant etc
etc but no luck that route either.

On Error GoTo trapme94
Dim curcity As Long
Dim curcounty As Long
Dim appdt As Long
Dim juris As String
curcity = Forms!Permittools!Text256
curcounty = Forms!Permittools!Text258
appdt = Forms![tblPermitItem Subform]![Approval Date]
juris = Forms!Permittools!Jurisdiction & "'"

If juris Like "City" Then
Forms![tblPermitItem Subform]![Expiration Date] = appdt + curcity
Else

If juris Like "County" Then
Forms![tblPermitItem Subform]![Expiration Date] = appdt + curcounty

End If
End If

ExitExpDate:
Exit Sub
trapme94:
If Err.Number = 94 Then
Err = 0
Else

Resume ExitExpDate
End If

Thanks in advance!

Nov 13 '05 #1
2 1421
On 24 Jul 2005 08:07:35 -0700, "Manystrengths"
<ma************@tampabay.rr.com> wrote:

I can't quite follow your code - I typically tune out quickly when I
see Text256, Text258 etc., but it appears you may have the syntax
wrong, as well as some data types.

dim dtApprovalDate as Date
dtApprovalDate = [Approval Date]
If you use Long instead, your code may fail or at least would not
behave as you expected.

If your code is in the parent form, this is how you access controls on
the subform:
dtApprovalDate = [tblPermitItem Subform].Form![Approval Date]
The way I think about it, without ".Form" you're talking about the
subform control itself, e.g.
[tblPermitItem Subform].Left = 200
With the ".Form" in place, you step into the subform and can now
access the form's properties and controls.

If your code is in the subform, this is syntax you can use:
dtApprovalDate = [Approval Date] 'a control on the subform
dim lngCityID as Long
lngCityID = Me.Parent.cboCity 'a combobox on the parent form.
Cool thing about ".Parent" is that this subform code will work
regardless of which parent it is on (as long as there is a cboCity on
it).

It appears you want to do date math. ALWAYS use the DateAdd function
for that.

-Tom.
Hello all.

Briefly described this is the problem I am having. I have a form, with
a related subform. On the subform I want to enter the expiration date
based on criteria in the main form. I have tried placing code in the
on exit event and the after update event with no luck. Please take a
look at the code and let me know what you think. Oh yeah..... I can
get this to work without using the main forms criteria ........ I
tried doing a Dlookup for this information dimming it as a variant etc
etc but no luck that route either.

On Error GoTo trapme94
Dim curcity As Long
Dim curcounty As Long
Dim appdt As Long
Dim juris As String
curcity = Forms!Permittools!Text256
curcounty = Forms!Permittools!Text258
appdt = Forms![tblPermitItem Subform]![Approval Date]
juris = Forms!Permittools!Jurisdiction & "'"

If juris Like "City" Then
Forms![tblPermitItem Subform]![Expiration Date] = appdt + curcity
Else

If juris Like "County" Then
Forms![tblPermitItem Subform]![Expiration Date] = appdt + curcounty

End If
End If

ExitExpDate:
Exit Sub
trapme94:
If Err.Number = 94 Then
Err = 0
Else

Resume ExitExpDate
End If

Thanks in advance!


Nov 13 '05 #2
Thanks tom. I'll give it a go........ I expected to meet with some
doubt when posting this code with textboxes named text. I impatiently
was trying to get this code to work so they were added to the form
quickly to look up the values to calculate the expiration date.
Hopefully I can get this to work.

Thanks again.

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: TurboDuster | last post by:
I've posted a question here twice and unfortunatly got no reply. Maybe it's a hard question. Maybe I've broken some sort of netiquette and I'm being shunned. Don't know. If the former, I would...
5
by: PaulThomas | last post by:
Working with XP-Pro and VS.Net I have set my Start Page to "Home.aspx" but the application always starts the "Login" page - - - How can I change the start page to the Home.aspx??? On the login...
0
by: Raconteur | last post by:
Hi gang, Very sorry if this is in the wrong place, but I am at my wits end with this thing and am in DESPERATE need of some assistance, ANY assistance... I have a Service that I wrote that...
5
by: Tamar | last post by:
Hello all, I am so frustrated. I am doing something so simple and yet I confront such a problem. I am writing a program in VB, opening a db connection to an access db using ADODC control. I...
2
by: Andla | last post by:
Hi! I thought that using axWebBrowser control would be the same as using Internet Explorer. All that IE can do i can do with this COM control. It seams that this isn't the case. I'm trying to...
4
by: Al Murphy | last post by:
I have a windows application called "WindowsApplication1". I have a variable of tyoe DataSet called myDataSet as shown below: namespace WindowsApplication1 { public class Form1 :...
4
by: Ann | last post by:
I'm in a very frustrated situation now regarding to use jsp or asp.net. I'm a VBA programmer. Some of our web pages related with databases were setup in kind of old way , that is, in Access...
5
by: Chris | last post by:
Hi, I have been trying for days, yes days, to use the calender from the asp.net timetracker starter kit. I am now frustrated. I finally get the popup calender to popup but when I click ok to...
2
by: Nina | last post by:
Hi there, I've tried everything that I know to prevent usre resizing datagrid columns, but nothing works. Following are the code that I used. Please tell me what's wrong with them. Thank you....
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.