Foreign key from another table, and a primary key from the one being used.
i am still sort of a novice to access programming,
I have “tblMain” with a primary key “tracking number”
“tracking number” has a one to many with the table “tblPend”
“tblPend” has a primary key “RecordNo” and a status check box “status”
Status will either be marked yes or no.
All of these fields are on a form “frmPend”
This form opens from another form, but carries the tracking number from a field on the previous form. A subform at the bottom of the form runs a query “QryPend” and brings up all records in “tblPend” that have the referenced tracking number.
What I want the form to do is take the referenced tracking number, and open the first record with a status of yes in the form.
i can get the dlookup to work, but it looks it up for all tracking numbers not the tracking number specific to the form.
Can anyone help?
7 3936
Hi,
What do you mean by the first record? Is it the first created, or the first in the record sequence? I think you may need to have an intermediate query that identifies the specific RecordNo you require from the "tblPend" table.
Let me know how you get on.
@jonnyboy
but the specific record that is required is going to be based on what data is listed in the form.
how would i get the form to run the query using data specified in the form?
@jonnyboy
ok i have been able to get a query to search and bring up the record i need, as well as a dlookup to get the specific record number to open in the form.
the problem is, these forms are unbound and do not actually populate the fields with the data i need.
i need the form to get the matching the record number and open that record.
NeoPa 32,557
Recognized Expert Moderator MVP
Is tblPend.Status a boolean (Yes/No) or a string field?
What is the name of the control on your form which contains the Tracking Number you want to find in your DLookup()?
@NeoPa
i have 2 fields for tracking records in 2 different tables,
[tracking number] which is the primary key in tblMain which has a 1 to many with tblPend, whos primary key is [trackingno]
yes it is a check box that returns a value of yes or no,
this is what i have so far,
i have a query that runs based on the tracking number thats entered in the form, and a dlookup that looks up the first value with a status of "yes".
it searches the records that match the [tracking number] in the form with a status of "yes", and outputs the [recordno] into a non bound field.
i want the form to open the record for the specific [recordno] returned. the [recordno] field is an auto number.
i need to take that record no, and have the form populate with the data saved in that record.
also if no records match, then it should open ready to create a new record.
does this make sense? i feel like im still to novice to asq my questions correctly.
NeoPa 32,557
Recognized Expert Moderator MVP
I don't feel I can sort your whole situation out for you as there is frankly too much information here that isn't quite consistent. I don't mean to be critical, because it's perfectly understandable that there are issues you don't fully understand. It does however, make it particularly complicated for people like me who have details and precision as the makings of our comfort zones.
I was proposing to post a (relatively) simple, multi-criteria, DLookup() example that you could build on. For that I need answers to my two questions (I do see your answers). For the answers to make sense though, I should explain that tblPend.Status is a field (found in a record) and not a control (found on an form - or report). The Tracking Number name I am after is conversely a control name, and not either of the two related field names you've provided.
Let's get this simple part done first and then (maybe) we can consider progressing on from there in small stages.
PS. Please don't think I'm trying to belittle your efforts so far. I do really acknowledge that you have tried to respond as asked, and that is the main thing I look for.
PPS. I stumbled across your response almost by accident. I didn't get notification of a reply, even though it's a subscribed thread. If you notice a large delay in future (>24 hours) feel free to bump the thread so I should notice it again. Bear in mind Christmas though, of course. I hope not to be available too much over the holidays - otherwise my life is getting just too sad.
Just for the record, I am always humbled by the politeness displayed on this board. Thank you,
First I will give you a high level description of what I am trying to accomplish.
As I said before I have 2 tables, the main table whos records are distinguished by a tracking number
And a pending record table that serves the purpose of creating pending records for the records in the main table(this also has a primary key called “recordno”).
The records from the main table are made through forms the client uses, and processed through forms the specialist uses, which open up the information entered by the client plus additional fields the specialists need.
Sometimes these records need to be pended for approval. I am trying to automate this part of the application.
I have created a form (frmpend). This form currently transfers the tracking number from the specialist form, and opens the pend form with the tracking number field populated.
It also contains a “start pend date”, “end pend date” field, along with a status check box. All of these are controlled by one button. When the start date is populated, the check box( checked when file is pended )is also populated. When the end date is populated, the check box is cleared.
What I want this form to do, is search for any records that are currently marked as pended, and open them up with the form for editing. If no records are found, a new record will be created.
It should only be looking for records based on the tracking number carried over from the previous form, as well as a status marked as yes.
If I am able to set it up this way, only one record per tracking number can be marked as “yes” at one time.
I do have a query that searches for the tracking number and a status if “yes”. I was also able to use the dlookup to retrieve the first “recordno” of a pending record marked “yes” for a given tracking number.
Here are the tables and forms info,
tables
tblMain: Tracking Number,(there is quite a bit of other information on this table, but none of it is necessary for this part of the application.) tblPend: Recordno, start pend date, end pend date, status, tracking number,
forms
frmSpecialist: button(pending information)
frmPend: tracking number, recordno, start pend date, end pend date, button(pend/unpend), status(checkbox)
would I be able to take the record number produced by the dlookup and open up that record? Or should I choose an alternate method?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: KLAU |
last post by:
I have a field that retrieves information from an expression in a
query. I have used a DLookup function to get the calculated field
from the query. However, the relationship is 1-to-many so one...
|
by: Rich Bernat |
last post by:
We have vending machines which are serviced by emptying the money
inside the machine and placing it into numbered bags. Each bag is
numbered independently of the machines. Each machine has a...
|
by: ShyGuy |
last post by:
I have a table with 4 fields. Three are used for criteria.
I can get the DLookup to work with 1 criteria with the following but
can't get it to work with 2 or three.
NumofAppts = DLookup("",...
|
by: chris.thompson13 |
last post by:
I am having a problem setting the criteria part of the DLookup method
correctly and am consequently getting an error message.
I have a database of staff duties, part of which is a query (qryDaily)...
|
by: bjaj |
last post by:
Hi
How do I use a boolean criterian with the funktion DLookup ?
I know the syntax for strings, numeric and date as follows
For numerical values:
DLookup("FieldName" , "TableName" ,...
| |
by: MSeda |
last post by:
I have a loop that is controlled by a Dlookup statement with two criteria. Both criteria fields are checkboxes. I have tried an assortment of quotation marks in the criteria section and cannot get...
|
by: JHNielson |
last post by:
I have a query that I'm trying to update with a dlookup with multiple criteria
This is the string:
EVNT_DT: DLookUp("","","( .EVNT_QTR=.) & (.=.)")
When i run it it says it can't find the...
|
by: BradHodge |
last post by:
Wouldn't ya know it. Posting a question on my first day of "ExpertDum" :)
How do you use DLookup with multiple criteria from the same table?
I have a report and I want a text box to display...
|
by: Denise |
last post by:
Front end is Access 2002, back end is linked Oracle tables.
My users need to describe things in feet and inches and want to use
the standard ' and " abbrevations.
On a testing form I go to a...
|
by: Constantine AI |
last post by:
Hi i am trying to get User input if data does not exist within a DLOOKUP table. I have gotten it to work for one record but not multiple, i have tried to incorporate my code into a loop procedure but...
|
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,...
| |
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...
|
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,...
|
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: 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |