Using Query To Find A Record

Jun 29, 2005

The strSql string should find the record that I have already saved in my admin table and then compare it with combusername, where is my mistake.


Private Sub Command7_Click()


'Dim db As Database
Dim strSql As String
'Set db = CurrentDb()


strSql = "Select adminpass From admin"


If ((Nz(txtpassword, "") = "") Or (Nz(combusername, "") = "")) Then

MsgBox "Please Enter A Valid Access", vbOKOnly, "Error"

ElseIf (txtpassword = "admin" And combusername = strSql) Then

DoCmd.Close acForm, "Secure"
DoCmd.OpenForm "Home"


ElseIf (txtpassword = "user" And combusername = "user") Then

DoCmd.Close acForm, "Secure"
DoCmd.OpenForm "Home"

Else

MsgBox "Wrong Password, Please Try Again", vbOKOnly, "Error"
combusername = ""
txtpassword = ""
combusername.SetFocus


End If

End Sub

View Replies


ADVERTISEMENT

Find Latest Record With Query

Aug 22, 2007

I'm fairly new to SQL and have a problem finding the latest record.

Lets say I have a development project that has many disbursal payments to be sent. I want to find the latest disbursal record created for that one project instead of having all of the disbursal records show on the query.

I'm trying to work out how to do this in a query but haven't got a clue where to start.

Please, if anyone can help I'd be very grateful!:D

View 2 Replies View Related

Queries :: Find Previous Record In A Query?

Jun 13, 2015

How do I find the previous record in a query using the autonumber field?

View 10 Replies View Related

Queries :: Detect When Query Fails To Find A Record

Oct 29, 2013

I have ASSET_TYPE, MANUFACTURER and MODEL tables.

I have a Table ASSET_COMBO that links to the above tables.

I have a form to create amend an ASSETS table. The form uses combo fields to filter the options available to the user. I.E the User Picks Manufacturer then selects from list of Asset Types provided by that Manufacturer, then selects from list of Models.

I want to create a form to allow create and amend records on the ASSET_COMBO Table.

The problem I have is that I want to ensure that there are no duplicates on ASSET_COMBO Table. I know that I can Select Multiple keys from the table with no duplicates allowed. But from what I have read this can cause problems. Is there a simple way that I can detect that a query on the ASSET_COMBO Table has returned a valid record or has not found a record.

View 3 Replies View Related

General :: Find Record From Field In Subform And Then Return Its Parent Record

Feb 6, 2014

I have a database which has a main form and subform built in linked by parent/child customerid, what i would like to do is search all the subform records from the whole DB and return its parent record on the main form?

Can this be done? because if i use find it will only search the filtered form i have onload of the form?

My onload event is based on fosusername()

View 3 Replies View Related

How To Use Key Find A Record ?

Aug 17, 2005

Hello to all,
Little new in Access i would like to know how to use the key to find directly to a record in a table.
ie : i have a table where the primary key (unique) is a date, using VBA i would like to know the instruction to find directly the record 01/06/2004 for exemple.
Thanks in advance.
VINCENT

View 2 Replies View Related

Find Record

Jun 14, 2005

I forgot to mention that my form is based upon a table, i have created other tables and forms based on this one therefore I don't want to change a lot of stuff. I tried the forum but nothing helped.



I have a form with about 10 fields, i added a find button to search for a record, using three fields, when this button is click i want it to display all the info pertaining to the search criteria, (this will be displayed on the same form populating in the form which contains other feilds) or a error saying record not found.

Thank You

View 2 Replies View Related

Find Record

Mar 30, 2006

Hi, i am a beginner to access and need some help if someone would be kind enough...
i have a table (tblCustomer) which has all the standard customer details such as name, address, phone etc. The primary key of the table is a autonumber field (Customer ID). i have autoformed it so all the fields are now on a blank form. I want to add a text box to the form so that i can find a record by typing the customer's surname. Once this has been searched, i would like the records to be listed in a table in a subform further down the original form. I would then like the user to select the correct record they are looking for from the sub form, and the details to come up in the main form so they can be edited. The reason for the whole sub form part is because there may be more than one customer with the same surname.
please could someone suggest how to achieve this.

thanks

View 3 Replies View Related

Find Record

Mar 30, 2006

Hi, i am a beginner to access and need some help if someone would be kind enough...
i have a table (tblCustomer) which has all the standard customer details such as name, address, phone etc. The primary key of the table is a autonumber field (Customer ID). i have autoformed it so all the fields are now on a blank form. I want to add a text box to the form so that i can find a record by typing the customer's surname. Once this has been searched, i would like the records to be listed in a table in a subform further down the original form. I would then like the user to select the correct record they are looking for from the sub form, and the details to come up in the main form so they can be edited. The reason for the whole sub form part is because there may be more than one customer with the same surname.
please could someone suggest how to achieve this.

thanks

View 7 Replies View Related

Find Record

Sep 26, 2006

I have navigation between forms and when a user navigations from the main form(candidate) to another form(1) and then back there is only 1 record displayed on the candidate form as it is only bringing back the record tied in by the application number.
So if you then want to search for another candidate it doesn't work because the candidate form is filtered.

I've tried using this in my find function but it doesn't work: DoCmd.GoToRecord , , acFirst

Can anyone help?
Thanks,
Dan

View 2 Replies View Related

Find First Record In A Set Of Fields

Nov 8, 2005

I have 12 fields, each containing a number. I want to display the last non zero value in a query. I've looked at "last" but this returns the items in chronological order, which is not neccessarily the order my data is entered in.

eg.
fields: 1 2 3 4 5 6 7 8 9 10
data: 0 7 3 0 0 5 4 0 0 0

I would want the query to return 4, even if the last value entered was the 7.

To make it more complicated, I have many rows of data for each set I am using, and have to aggregate these based on a key column

eg.

Fields: key 1 2 3 4 5 6
Data: 1 0 0 0 2 0 1
1 0 0 0 3 0 3
1 6 5 4 3 2 1
2 1 2 3 4 5 6
2 0 0 0 0 0 0

Any tips?

Cheers
Kev

View 4 Replies View Related

Find Record Error

Feb 10, 2005

I have a form with a form header section that contains a combo box and a text box. The form also has a detail section that has a tab control that contains the rest of the data entry boxes. I put a Find Record button in the detail section of my form. When I try to Find Record using the combobox or textbox values in the form header, I get an error saying it cant search the tab control, use the Gotocontrol action before the Find Record Action, change current field action from yes to no, or change the focus to a searchable control. If I search items in the detail section I do not get errors. The code created by the Find Record button is below. I'm not sure how to get it to set focus to the appropriate box in the form header section if that is the field I am searching on.

Private Sub cmdFind_Click()
On Error GoTo Err_cmdFind_Click


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_cmdFind_Click:
Exit Sub

Err_cmdFind_Click:
MsgBox Err.Description
Resume Exit_cmdFind_Click

View 1 Replies View Related

Find Record Problem

May 31, 2005

Hello,

I have a large database I set up and we have been using fine for a couple of years now.

All of the sudden, anytime Find Record is clicked and the value is entered, I am getting the following error, on ALL forms. Nothing has been changed in the DB itself and it worked GREAT before.

The control 'Command 138' the macro is attempting to search can't be searched.

Try one of the following:
* Add a GoToControl before the FindRecord action.
* For the FindRecord action, change the Only Current Field action argument from yes to no.
* Change the focus to a searchable control.

Can anyone help? It is VERY frusterating and I can't figure it out.

Thanks so much! ;)

View 5 Replies View Related

Find Record Based On Cbo Box

Jun 6, 2005

I have a combo box that displays LastName FirstName.

If I have two people with the same lastname it finds the first one in the table w/ that last name. Please help with my code so it searches by firstname and last name. Thanks in advance.

Kacy

' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[Contact_LastName] = '" & Me![cboContact] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark

View 4 Replies View Related

Find Record From Listbox

Jul 20, 2006

I've enclosed a screenshot as it tells the story pretty well by istelf.

I would simply like to be able to click any item in the listbox (populated from a query simply showing all records in a table). Once an item is clicked in the listbox, I'd like the form to go to that record (this is to enable quick finding and deleting of records).

I've been playing for a while, and can't figure out how to make Access go to the record that's selected in the listbox.

Thanks for any help.

Steve

View 7 Replies View Related

Find Record Problems

Oct 25, 2004

On one of my forms I have a command button to find a record. The Find button is supposed to locate a record based on it's job number, this is not a primary key. I have this feeling it has something to do with the field Job Number because it is like this throughout the db (it is only recognizing the first record.) I even tried putting in another record but it still only recognizes that one record. What did I do wrong?

learnasugo

View 14 Replies View Related

Find The Last Record In A Table

May 30, 2005

Hi,
Newbie problem. I want to display on a form the last entry or (record) from a particular field of a table
(the date field of the last club event). I have set the Form Property of 'Data Entry' to 'Yes' to prevent the user from
having to scroll through records to get to the next blank record. Could someone kindly give me a clue how to go about
displaying that last record of the field. Thank you.

View 1 Replies View Related

General :: How To Find A Record

Jul 9, 2014

I have developped a table and some forms reated to that.Since the main survey is quite long, I developed 4 forms to enter the data. Now I have a question related to data entry.Suppose I start entering data for one record and I decide not to fill up all the 4 forms, I simply decide to go back to it later. How can I go to the same record and keep entering the data from where I left?

If I am in Datasheet view, I can easily use the Find option to look for the record. However, I dont seem to be able to understand how I can open the form of that record to enter the remaining data.

View 14 Replies View Related

Find Record Command Button

Oct 26, 2005

I know you can create a find record command button really simply, which when clicked will display the find and replace window.

What i want to do is create a command button that will search a specific field that i specify in a report for the criteria i enter.

i.e i have a customer information form, which contains

AccountNo
CompanyName
Address
Postcode
Tel etc

what i want is a button that when clicked brings up an input field that allows the user to type the name of the company into this field, then when either the enter key is pressed or another button on this pop up window the matching record will be displayed or a error window stating that there are no matching records. Can anyone help me with this.

View 2 Replies View Related

Using 'Group By' To Find A Specific Record...

Oct 10, 2005

Hi,
I have a table with various customer items, a current price and the date the price changed.

EXAMPLE DATA

CustID/ItemCode/DateChanged/Value
AAA 21 01/01/2004 £3.00
AAA 21 01/06/2005 £5.00
AAA 21 01/03/2005 £4.00
AAA 22 01/01/2005 £6.00
AAA 22 01/06/2005 £7.00
BBB 25 01/01/2005 £8.00
BBB 25 03/07/2005 £9.00
BBB 26 01/06/2005 £1.00
BBB 26 01/09/2005 £2.00

Note: Dates are in "dd/mm/yyyy" format. Also, not all data is in order in the table. It’s not how I would have designed it but that’s what I need to work with!

I would like to run a query that groups by custID & itemcode and also the most recent date for any price change. I would then like the query to display the relating price for the record it pulls out. (EG for custID 'AAA' and item 21, it would display the price of £5 as that is the value for the most recent price as of 01/06/2005)
I then want to link the custID & itemcode to another table that has sales in, to check that we are using the most recent price.

Is there a way I can do this via a query or do I need to put some code together?

Cheers
Red [CODE]

View 2 Replies View Related

Find A Record That Doesn't Exist

Oct 26, 2005

I have a training database with multiple courses. Certain staff do course1 and thereafter course2. Course1 is only done once and course2 is a refresher done annually. I want the query to find staff that have done course2 but not course1.

Thanks.

View 3 Replies View Related

Find Record Based On Combo Box

Mar 17, 2005

Hi

I have a search form with 1 combo box and a button which when the user inputs an invoice number and clicks the button, a main form is opened for that particular record.

The problem I have is to display an error message before the main form opens if the user has either left the combo box blank or they have input an invoice number that doesn't exist.

This feels like it should be easy......!

Thanks for any help

Georgina

View 3 Replies View Related

Problems With Find Record Action

Jan 18, 2006

i have an issue with the find record functionality

i have a main form that has a search button which works fine

i have a link to a popup form which in turn also has a search button but clicking this produces an error as below

run time error 2046

the issue seems to be the caused by the fact that the main form is still running in the background - if i open the popup form directly the search works fine

is there a way to get the search going on the po up form with the main form still running in the background?

View 4 Replies View Related

Find Record By Entering Data

Jan 23, 2006

I have a form which my client likes but he doesn't like to use a search button.

The two indexed fields are EMPLNO and LASTNAME.

By entering the employee number into the form and/or by entering the lastname onto the form you would get the record for that employee onto the form.

Its probably covered in the archive but I don't know what to look for.

Any suggestions?

View 4 Replies View Related

Combo Box To Find Record - Wrong Value!

Mar 20, 2006

Hello,

I have a form and I have added a combo box to quickly find records. I used the wizard to set this up as I did not know the code. Anyway this works, but it displays the wrong value - it displays the ID number and not the text value from the table.

The record source is a table not a query.

What am I doing wrong here, I have tried changing the control source and it doesn't work.

Any suggestions?

View 5 Replies View Related

Find Record + SINGLE FORM

Mar 30, 2006

Is it possible to create text box for search for records if I use SINGLE FORM?
i try but without effect :(

pls see my database (I want to use for record "Title")

Thanks

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved