Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old August 11th, 2004, 12:15 PM
Hbanerje Hbanerje is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 10 Hbanerje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Need help in vb coding

I have an access form, in the form I have a combo box, feild name is Master Agreement with yes and No, I have other feilds ACSadd_date, IRISadd_date, CD-ROMadd_date, Str Fund Mgr_add_date, Ediadd_date... and other feilds are like different services such as ACH, IRIS, CD-ROM..
So When a customer has couple of services such as ACH and IRIS, their corresponding add_date feild have a date. there are another fields are ACHcontract_reiceved, IRIScontract_reiceived, CD-ROMcontract_received..
What I want to do is if some body goes and change the Master Agreement combo box to yes and if the add_date feild is not null or empty then all the corresponding contract_received fields(which are combo boxes with a value list yes, no and not required) will be automatically yes.
Now I have the code that whenever sombody is clicking the master agreement combo box and saying yes, all the contract_received fields are becoming yes. How I modify my code so that I can accomodate another criteria that also ACHadd_date or IRISadd_date or CD-ROMadd_dateis not empty then only make the contract_received feild is "yes".
The code I have now is
Private Sub Master_Agreement_AfterUpdate()
If Me![Master Agreement] = "Yes" Then
For Each ctl In Me.Controls
If ctl.ControlType = acComboBox Then
If ctl.Name <> "Master Agreement" Then
ctl.Value = "Yes"
End If
End If
Next
End If
If Me![Master Agreement] = "No" Then
For Each ctl In Me.Controls
If ctl.ControlType = acComboBox Then
If ctl.Name <> "Master Agreement" Then
ctl.Value = "No"
End If
End If
Next
End If


End Sub

This is urgent. This project has to be finished by this wk. Any help will be appreciated.
Thanks.

Reply With Quote
  #2  
Old August 11th, 2004, 04:09 PM
Mythomep Mythomep is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Zaandam, The Netherlands
Posts: 70 Mythomep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 37 sec
Reputation Power: 4
Send a message via MSN to Mythomep
Hi,

Your question is very confusing, but I think I get it. What you want:

When somebody sets the master agreement to yes, all the comboboxes for the services are set to yes only for those services that have a add_date.

With your current set-up, that's very hard. It will take alot of typing, but it is possible. First of, you need to use the following to check if a field is null (empty)

Code:
    If (IsNull(Me![CD-ROMAdd_date])) then
 	 ' The field is empty
   Else
 	' The field has a value
   End if
 


How did you name the comboboxes that contain the Yes/No values? If you could suply that, I might be able to give example code that does what you want within your loop.

Then, just a side question... You know how to normalize a database?

Grtz.©

M.

Reply With Quote
  #3  
Old August 12th, 2004, 09:54 AM
Hbanerje Hbanerje is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 10 Hbanerje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Need help in vb coding

IRISadd_date (input mask is a date field) which correspond IRIScontract_received which is a combo box with a value list(no, yes, not required), default value "No"
other date fields are ACHadd_date correspond ACHcontract_received,
CD-ROMadd_date..........CD-ROMcontract_received.
EDIadd_date.................EDIcontract_received

You got the idea what exactly I wanted to do.
I will welcome your tips on normalization of a table.
Thanks for the help.

Reply With Quote
  #4  
Old August 13th, 2004, 12:10 PM
Hbanerje Hbanerje is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 10 Hbanerje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Need help in vb coding

Can any body help me in this???????????

Reply With Quote
  #5  
Old August 16th, 2004, 08:23 AM
Mythomep Mythomep is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Zaandam, The Netherlands
Posts: 70 Mythomep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 37 sec
Reputation Power: 4
Send a message via MSN to Mythomep
Hi,

This is a quicky for me, but I think this might do the trick.

Code:
  Dim sService As String
  
  If Me![Master Agreement] = "Yes" Then
	For Each ctl In Me.Controls
	  If ctl.ControlType = acComboBox Then
		If ctl.Name <> "Master Agreement" Then
		  sService = Left$(ctl.Name, Len(ctl.Name) - 17)
		  If (Not IsNull(Me![sService & "add_date"])) Then
			ctl.Value = "Yes"
		  End If
		End If
	  End If
	Next
  End If


Grtz.©

M.

Reply With Quote
  #6  
Old August 16th, 2004, 09:22 AM
Hbanerje Hbanerje is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 10 Hbanerje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi I tried the code but it is giving me the run time error
" Customer DB can't find the field 'sService & "add_date referred to in your expression" .
I put the code in the properties of Master Agreement after update event.
I need help on this .
Thanks.

Reply With Quote
  #7  
Old August 16th, 2004, 09:25 AM
Mythomep Mythomep is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Zaandam, The Netherlands
Posts: 70 Mythomep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 37 sec
Reputation Power: 4
Send a message via MSN to Mythomep
Code:
Dim sService As String
  
  If Me![Master Agreement] = "Yes" Then
	For Each ctl In Me.Controls
	  If ctl.ControlType = acComboBox Then
		If ctl.Name <> "Master Agreement" Then
		  sService = Left$(ctl.Name, Len(ctl.Name) - 17)
  sService = sService & "add_date"
	If (Not IsNull(Me.Fields(sService).Value)) Then
			ctl.Value = "Yes"
		  End If
		End If
	  End If
	Next
  End If


Try this, I hope that it has a fields reference. Is this VB or VBA? From the looks of it VBA in a Access Form.

Grtz.©

Reply With Quote
  #8  
Old August 16th, 2004, 01:13 PM
Hbanerje Hbanerje is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 10 Hbanerje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It is VBA on a forms.
I tried the code it is giving me another error "compile error- Method or data member not found" It is pointing the Fields in the code.

Reply With Quote
  #9  
Old August 17th, 2004, 10:51 AM
Hbanerje Hbanerje is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 10 Hbanerje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I need help on this!
Thanks.

Reply With Quote
  #10  
Old August 17th, 2004, 10:53 AM
Mythomep Mythomep is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Zaandam, The Netherlands
Posts: 70 Mythomep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 37 sec
Reputation Power: 4
Send a message via MSN to Mythomep
Substitute me.fields("x") for the recordset that you update with the data.

Reply With Quote
  #11  
Old August 18th, 2004, 08:53 AM
Hbanerje Hbanerje is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 10 Hbanerje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
unfortunately, It is not working

Dim sService As String

If Me![Master Agreement] = "Yes" Then
For Each ctl In Me.Controls
If ctl.ControlType = acComboBox Then
If ctl.Name <> "Master Agreement" Then
sService = Left$(ctl.Name, Len(ctl.Name) - 17)
sService = sService & "add_date"
If (Not IsNull(Me.Fields(sService).Value)) Then
ctl.Value = "Yes"
End If
End If
End If
Next
End If

I replaced Me!Fields with IRISadd_date, it is not working,
I replaced with only IRIS, that's not working either...
When I am selecting Master Agreement to Yes all the combo contract_received are set to yes automatically, which I don't want. I only want to set IRIScontract_received to yes because IRISadd_date is has a date(not null).
I need help on this.
Thanks.

Reply With Quote
  #12  
Old August 19th, 2004, 04:05 PM
Hbanerje Hbanerje is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 10 Hbanerje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Is there any thought in it? I am stuck!!
Thanks

Reply With Quote
  #13  
Old August 19th, 2004, 06:14 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 18 h 33 m 48 sec
Reputation Power: 180
try stepping through your code with the debugger. You should be able to pinpoint the error that way.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #14  
Old August 20th, 2004, 03:20 AM
Mythomep Mythomep is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Zaandam, The Netherlands
Posts: 70 Mythomep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 37 sec
Reputation Power: 4
Send a message via MSN to Mythomep
Hi,

I seem to fail in this question, my sincere apologies for that. From my point of view, it is easy enough to see that you need to access the fields of the recordset on the form or the datacontrol that is coupled to the controls. However, I get the distinct feeling that those concepts are not understood.

Let me ask this the other way round. Do you have a datacontrol on your form? If so, what is the name of it. If you have no datacontrol on your form, how do you retrieve the data in the controls?

Grtz.©

M.

P.s. If I step on someone's toes, I am sorry. The above is my professional opinion.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Need help in vb coding


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |