Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

dlookup

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tmaxwell - 04 May 2007 15:23 GMT
I need to write a query to link a number of table together so I can build a
form page that the project managers can type in a part number and retrieve
all the specs of the part. Can I use the dlookup to do this?
Ofer Cohen - 04 May 2007 16:10 GMT
Don't use DLookup for that,

Create a form based on the query you created, and then add another search
text box where the user can input  value and all the related field will pear.

Check this link on "Searching for a record based on a text box value in a
form:"

http://www.databasedev.co.uk/text_search.html

Signature

Good Luck
BS"D

> I need to write a query to link a number of table together so I can build a
> form page that the project managers can type in a part number and retrieve
> all the specs of the part. Can I use the dlookup to do this?
tmaxwell - 07 May 2007 17:06 GMT
I am trying to use a cmdSearch command button. I have a query that I built
the form page from and I need the ability to type in a part number and have
the cmdSearch find the record. The query is named PARTSEARCH and the part
field is 2nditemnum as MODEL. Please take a look and let me know why this
won’t run. I can give more detail.



Option Compare Database


Private Sub cmdSearch_Click()
    Dim strPARTSEARCHRef As String
    Dim strSearch As String
   
'Check txtSearch for Null value or Nill Entry first.

    If IsNull(Me![txtSearch]) Or (Me![txtSearch]) = "" Then
        MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criteria!"
        Me![txtSearch].SetFocus
    Exit Sub
End If
'---------------------------------------------------------------
       
'Performs the search using value entered into txtSearch
       
    DoCmd.ShowAllRecords
    DoCmd.GoToControl ("2NDITEMNUM AS MODEL")
    DoCmd.FindRecord Me!txtSearch
       
    str2NDITEMNUM AS MODEL.SetFocus
    strPARTSEARCHRef = str2NDITEMNUM AS MODEL.Text
    txtSearch.SetFocus
    strSearch = txtSearch.Text
       
'If matching record found sets focus in  and shows msgbox
'and clears search control

    If strSEARCHRef = strSearch Then
        MsgBox "Match Found For: " & strSearch, , "Congratulations!"
        str2NDITEMNUM As MODEL.SetFocus
        txtSearch = ""
       
    'If value not found sets focus back to txtSearch and shows msgbox
        Else
            MsgBox "Match Not Found For: " & strSearch & " - Please Try
Again.", _
            , "Invalid Search Criterion!"
            txtSearch.SetFocus
    End If
End Sub


Private Sub txtSearch_BeforeUpdate(Cancel As Integer)

End Sub

> Don't use DLookup for that,
>
[quoted text clipped - 9 lines]
> > form page that the project managers can type in a part number and retrieve
> > all the specs of the part. Can I use the dlookup to do this?
Ofer Cohen - 07 May 2007 18:10 GMT
What error do you get?

Also, when you have a name of a control , field, table that consist more the
one word it need to be in square brackets

DoCmd.GoToControl ("[2NDITEMNUM AS MODEL]")

Is that  "[2NDITEMNUM AS MODEL]" the text box name?

Note: It's not recomnded to give names to the controls when they consist
more then one word.

You can write it as, so it will be connected
2NDITEMNUM_AS_MODEL
Signature

Good Luck
BS"D

>  I am trying to use a cmdSearch command button. I have a query that I built
>  the form page from and I need the ability to type in a part number and have
[quoted text clipped - 66 lines]
> > > form page that the project managers can type in a part number and retrieve
> > > all the specs of the part. Can I use the dlookup to do this?
tmaxwell - 07 May 2007 18:31 GMT
The error is "There is no field named 2NDITEMNUM AS MODEL in the current
record"

[Daily Sales].[2NDITEMNUM] AS MODEL so I have named it 2NDITEMNUM as MODEL

> What error do you get?
>
[quoted text clipped - 81 lines]
> > > > form page that the project managers can type in a part number and retrieve
> > > > all the specs of the part. Can I use the dlookup to do this?
Ofer Cohen - 07 May 2007 18:46 GMT
If the field name MODEL then try

DoCmd.GoToControl ("MODEL")

Signature

Good Luck
BS"D

> The error is "There is no field named 2NDITEMNUM AS MODEL in the current
> record"
[quoted text clipped - 86 lines]
> > > > > form page that the project managers can type in a part number and retrieve
> > > > > all the specs of the part. Can I use the dlookup to do this?
tmaxwell - 08 May 2007 21:31 GMT
It works right through the DoCmd.GoToControl ("MODEL") but hangs at the
DoCmd.FindRecord Me!txtSearch . Do I need to add the FindFirst option?

Private Sub cmdsearch_Click()
   Dim strPARTSRef As String
   Dim strSearch As String
   

   If IsNull(Me![txtSearch]) Or (Me![txtSearch]) = "" Then
       MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!"
       Me![txtSearch].SetFocus
   Exit Sub
End If
'---------------------------------------------------------------
       

   DoCmd.ShowAllRecords
   DoCmd.GoToControl ("MODEL")
   DoCmd.FindRecord Me!txtSearch
       
   strMODEL.SetFocus
   strPARTSRef = strMODEL.Text
   txtSearch.SetFocus
   strSearch = txtSearch.Text
       

   If strPARTSRef = strSearch Then
       MsgBox "Match Found For: " & strSearch, , "Congrats!"
       strMODEL.SetFocus
       txtSearch = ""
       
   
       Else
           MsgBox "Match Not Found For: " & strSearch & " - Please Try
Again.", _
           , "Invalid Search Criterion!"
           txtSearch.SetFocus
   End If
End Sub

> If the field name MODEL then try
>
[quoted text clipped - 90 lines]
> > > > > > form page that the project managers can type in a part number and retrieve
> > > > > > all the specs of the part. Can I use the dlookup to do this?
Ofer Cohen - 08 May 2007 23:21 GMT
Can you post your mdb to
chamudim <@> hotmail <.> com

I'll would like to have a look at it.
If you don't mind sending it, then zip it first because hotmail has issues
with mdb's

Signature

Good Luck
BS"D

> It works right through the DoCmd.GoToControl ("MODEL") but hangs at the
> DoCmd.FindRecord Me!txtSearch . Do I need to add the FindFirst option?
[quoted text clipped - 130 lines]
> > > > > > > form page that the project managers can type in a part number and retrieve
> > > > > > > all the specs of the part. Can I use the dlookup to do this?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.