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

Table search

67
Hello all

Below is some code. This is the only way i know how to say what i want to happen. Could someone please re-code this so that it works please.


Private Sub Postcode_LostFocus()
If Me.Postcode = Table!tblSales!PostcodeAnd Date >= Table!tblSales!DateOfVisit + 30 Then
Me.lblOutstanding.Visible = True
End If

End Sub

Kindest Regards

Wayne
Feb 6 '09 #1
5 1387
ChipR
1,287 Expert 1GB
What are the fields and field types in your tblSales?
You probably want to use DLookUp to get the values from the table.
Feb 6 '09 #2
Wayneyh
67
The fields in tblsales are Postcode which is a text field and DateOfSale which is a date field
Feb 6 '09 #3
OldBirdman
675 512MB
Let's start with some basics:
Table=tblSales has 2 fields, Postcode and DateOfVisit
Form=frmYourForm should have 4 controls:
txtPostcode TextBox - hidden, bound to Postcode - not good to name same as table field as this generates confusion.
txtPostcodeEntry - TextBox
txtDateOfVisit TextBox - bound to DateOfVisit
lblOutstanding - Label
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtPostcodeEntry_LostFocus()
  2. If Me.txtPostcodeEntry = Me.txtPostcode And Date >= Me.txtDateOfVisit + 30 Then
  3. Me.lblOutstanding.Visible = True
  4. Else
  5. Me.lblOutstanding.Visible = False
  6. End If
  7. End Sub
  8.  
Me.txtDateOfVisit + 30 might be better as DateAdd("m",1,Me.txtDateOfVisit)
Feb 13 '09 #4
Wayneyh
67
Thanks for your input

Wayne
Feb 13 '09 #5
missinglinq
3,532 Expert 2GB
While we're on basics, this kind of code is better being placed in the textbox AfterUpdate event, rather than its LostFocus event.

The AfterUpdate event fires if a blank textbox has had data entered, or if the data has been edited. This is what you're trying to do.

The LostFocus event fires every time you tab thru the field, even if nothing changes, which is a waste of processing time.

For this type of formatting, you also need to include the code in the Form_Current event, so that as you move from record to record, the lblOutstanding label appears or is invisible, as is appropriate.

Linq ;0)>

.
Feb 14 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Smartin | last post by:
I have a form in Access97 which facilitates a query against a production Access database. Users will enter some search terms and see a datasheet view of the results in a subform. The prod table is...
3
by: Al Wilkerson | last post by:
Hey, I have a Web Form with a drop down list, textbox, and search button. When click the search button an SQL server database is queried fordata. Once I have the data in a dataset I use the...
1
by: Al Wilkerson | last post by:
Hey, I have a Web Form with a drop down list, textbox, and search button. When click the search button an SQL server database is queried fordata. Once I have the data in a dataset I use the...
1
by: B | last post by:
Hello All, This is my first time using this list, but hopefully I got the right one for the question I need to ask :). I have a table which has about 4 million records. When I do a search...
3
by: vonclausowitz | last post by:
Hi All, I was thinking of creating a table in my database to index all words in the database. That way I can quickly search for one or more words and the index table will return the words and...
15
by: l3vi | last post by:
I have a new system Im building that stores entries of what people are searching for on my sites. I want to be able to keep records of how many times a keyword was searched for daily, and from...
2
by: Memborg | last post by:
Hej Everybody I have tried do make an "instant search" in javascript, ie everytime one hits a key the javascript sends the request to a database and returns the result into a table. The...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
1
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and...
1
by: since | last post by:
I figured I would post my solution to the following. Resizable column tables. Search and replace values in a table. (IE only) Scrollable tables. Sortable tables. It is based on a lot...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.