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 / New Users / June 2006

Tip: Looking for answers? Try searching our database.

Access handling

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
blaze - 03 Jun 2006 19:13 GMT
I would like to set up a  window that would be called from my switch board
where I would enter a number. have the number checked against a database and
if it is in the data base be placed on that record or otherwise asked if I
would like to add a new record to the DB.

Could anyone tell me how to do this using simple sentences?
Steve Schapel - 03 Jun 2006 21:16 GMT
Blaze,

There are a number of ways of going about this.  And I am not 100% clear
what "be placed on that record" means, but I assume this is a record ID
numberr of some sort.  So, I'll have a go.  Let's use an Input Box to
get the number from the user.  So, on the Click event of the button on
your switchboard form, you could put a VBA procedure something like this...

 ' create a variable for the number
 Dim KeyNumber As Long
 ' open an input box for the entry of the required number
 KeyNumber = InputBox("What is the number?")
 ' see if there is already a record in the table with this number
 If DCount("*","YourTable","[YourID]=" & KeyNumber) > 0 Then
    ' if so, open the form at that record
    DoCmd.OpenForm "YourDataForm", , , "[YourID]=" & KeyNumber
 Else
    ' if not, ask with a message box about adding a new record
    If MsgBox("Add new?", vbQuestion + vbYesNo) = vbYes Then
       ' if so, open the form at a new record
       DoCmd.OpenForm "YourDataForm", , , , acFormAdd
       ' ... and insert the number into the new record
       Forms!YourDataForm!YourID = KeyNumber
    End If
 End If

Hope that makes sense.  You will, of course, need to replace the actual
names of your own form and table and field into the above example.

Signature

Steve Schapel, Microsoft Access MVP

> I would like to set up a  window that would be called from my switch board
> where I would enter a number. have the number checked against a database and
> if it is in the data base be placed on that record or otherwise asked if I
> would like to add a new record to the DB.
>
> Could anyone tell me how to do this using simple sentences?
 
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



©2008 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.