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

Search in Form and Case ID

83
First question:
I have an assigned ID that is based on the month and year and then the numbered case. For example,
If a new policy came in in March of 07 and he was the 67th person who was entered for March of 07, then his case number would be 307-067
I would like to know if I can program visual basic to automatically assign a case a number when creating a new case using a form. AND I only want it to create the id once, not again when I update the form with other information at a later date. If that isn't possible, would it be better to create two forms, one that adds a new case, and one that edits a case. And in the one with the edit, just lock the case number.

Next Question: I have the database in excel currently. Once I am done building the access database, I want to transfer the table to access. When I do that, should I make the assigned id (the one spoken about above), the primary key?

Next Question:
When I want to edit a case at a later date, I want to be able to either click on the case in a query and the actual table and for it to automatically open the form to enter in the edited information. How do I this?

Next Question:
If I open a form, I want to be able to search by case-id(the one spoken about in question one). How do I do this? If I didn't want the case-id to be automatically assigned, then I could aways do an AfterUpdate of Case-id for every other variable in the form. Is there another way?
Apr 2 '07 #1
1 1474
MMcCarthy
14,534 Expert Mod 8TB
First question:
I have an assigned ID that is based on the month and year and then the numbered case. For example,
If a new policy came in in March of 07 and he was the 67th person who was entered for March of 07, then his case number would be 307-067
I would like to know if I can program visual basic to automatically assign a case a number when creating a new case using a form. AND I only want it to create the id once, not again when I update the form with other information at a later date. If that isn't possible, would it be better to create two forms, one that adds a new case, and one that edits a case. And in the one with the edit, just lock the case number.
This would depend on how new records are triggered. If you use a separate form to add a new record then something like the following should work in the open event of the form.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Dim assID as Long
  3.  
  4.    assID = DMax("CLng(Right([ID],3))", "TableName")
  5.    Me!ID = Month(Date()) & Format(Year(Date()), "yy") & "-" & Format(assID + 1, "000")
  6.  
  7. End Sub
Next Question: I have the database in excel currently. Once I am done building the access database, I want to transfer the table to access. When I do that, should I make the assigned id (the one spoken about above), the primary key?
Yes as long as it's value is unique.

Next Question:
When I want to edit a case at a later date, I want to be able to either click on the case in a query and the actual table and for it to automatically open the form to enter in the edited information. How do I this?
You don't. However, you can represent the table or query as a datasheet form and program the corresponding form to open in the On Current event.

Next Question:
If I open a form, I want to be able to search by case-id(the one spoken about in question one). How do I do this? If I didn't want the case-id to be automatically assigned, then I could aways do an AfterUpdate of Case-id for every other variable in the form. Is there another way?
Have a look at the following tutorial

Example Filtering on a Form

Mary
Apr 2 '07 #2

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

Similar topics

11
by: Matthew Robinson | last post by:
the page below returns just the search box everytime. ive not attempted to code the text search yet, but i want it to beable to filter out the category's, but its just not showing any. any idea's...
2
by: amoona | last post by:
Hi… I’m doing a search page form my work for their library. Since this is the first time I work with ASP I’m facing some problems. Each library item has different search data, I was able to...
4
by: Jan | last post by:
I am having problems trying to print a report based on a form. This is a search form only, no data input. There is a query that the form looks at, but then there are numerous comboxes that you...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
0
by: sandy21380 | last post by:
I have the following code in my program allowing users to search for entries matching up to five different criteria at once. I changed the form to now contain a subform and would like to allow the...
4
by: jl2886 | last post by:
LSI Case Number is an ID. It is constructed by "the month (1 or 2 digits) &theyear(2digits) & "-" & three digit number. I want to create a search for it on a form. In the following code the...
8
by: NMarks | last post by:
Hello all, I have created a database for my work that stores information for keys/locks, doors and employees. Specifically the database contains all the information of our lock system, which...
11
by: woodey2002 | last post by:
This problem is driving me crazy. Hello there, i am trying to create a search form for records in my access database. The search form will contain text boxes and a multi select list box. The user...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.