Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using two txtbox fields to automatically fill in a combo box (REPOST)

Status
Not open for further replies.

wshs

Programmer
Nov 22, 2005
220
0
0
US
i'm reposting because i've been browsing adn trying different things yet i can't find a solution to this problem..
thread702-1187654 (original post)

below is afterupdate event of txtad

Me.cboContName = _
DLookup("ContractName", "tbl_PSC", "ContractNo='" & Me!txtContNo & "' AND AddContNo='" & Me!txtad & "'")

I was two blank textboxes and a combo box on a form.
txtContNo, txtad, and cboContName.

I want to look up the table to find the correct "contract name" by filtering ContractNo and AddContNo.
This worked find when I had just
DLookup("ContractName", "tbl_PSC", "ContractNo='" & Me!txtContNo & "'")
But I realized table can carry multiple contract numbers with different addendum number. So now I need to find a way to find the corresponding contract name using both fields.

This is how the form should work. User types in the Contract Number and the addendum number and then cboContName returns a value automatically.

what am i doing wrong? any help would be great. thx

i keep getting an error "You canceled previous operation"
 
Is by chance cboContName bound ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
it's not suppose to right? well i tried it but.. getting the same response..
 
And this ?
Me.cboContName = _
DLookup("ContractName", "tbl_PSC", "ContractNo='" & Me!txtContNo & "' AND AddContNo=" & Me!txtad)


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
same response... that's the only even i have in there so i donno why its saying "previous operation".. i don't have any...
 
Just a guess:
Me.Dirty = False
Me.cboContName = _
DLookup("ContractName", "tbl_PSC", "ContractNo='" & Me!txtContNo & "' AND AddContNo=" & Me!txtad)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
that's still not working.. thank you for trying ph
Another question though...

I'm trying to make it so that when user clicks "cmdVoucher"
it only show the records that's under user's name...
i've tried creating a "txtStaffID" on the form and make it = to the txtStaffID on log-in form but that didn't work out.
i thought i could use DLookup function but i need to find multiple records using one textbox so i don't know how i can approach this.

so far i have...
docmd.openform "frm_psc_voucher"
Forms!frm_pwMonitor!staffid = Forms!frm_psc_voucher!txtStaffID

from here, i think i can use staffid somehow to only show his/her records... how can i approach this?
 
Have a look at the 4th argument of the DoCmd.OpenForm method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
you are talking about wherecondition right? i've tried it but didnt work... i'll take more time to look in to that though. thx
 
Most of my problem comes from this..
access can't filter because it can't find the form...
like with wherecondition and this linkcriteria...
any advice u can give?

stdocname = "frm_psc_voucher"

stlinkcriteria = "[staffID] = '" & _
Forms!frm_psc_voucher![txtStaffID] & "'"
DoCmd.OpenForm stdocname, , , stlinkcriteria
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top