Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

When you create a table, by default it has no Primary Key. When the records get inserted they appear, physically, in the order in which they are added. It is possible to have duplicate records (generally not a good idea). When you want to retrieve a record, because the table is unsorted, it can take a long time to locate the requested record. When you designate a field (or fields) as a primary key, records are sorted on that key. When you retrieve recordswithoout specifying a sort order, the records are returned in the order in which they appear in the table (sorted by primary key). Retrieving a record based on that key is fast (like using the table of contents in a book to go to a particular chapter). You can also designate another field as an index for other frequently used sorts and searches. However, each addition index requires the creation of supplementary data structures in the database so there is a tradeoff between speed and size.

So a primary key is like having a table of contents. It forces the records to be stored in a particular order. An additional index is like having an index at the back of the book except you need a separate index for each additional column designated as an index. Another term you might come across for primary key is clustered index Any other defined index is non-clustered.

To create a table containing last and first names you could do


       
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Do you have enough lines in the file to satisfy all of the textbox reads? What do you mean by "this page is linked to a database file"?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You do that by compiling the code. If you don't want anyone to see your code then don't release it. If you release horribly obfuscated code then you tell the world that you don't know #### about programming (whether or not that is actually the case). Would you leave a ton of crap in your car as an anti-theft device? It might work, but what image do you project to the world?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You should not use

Me.Controls("txbUserFld" & intIndex).Text = reader.ReadLine

because Me.Controls does not return a TextBox control. It returns a reference that must be converted to a TextBox reference. You can do that by assigning it to a TextBox variable or by doing an explicit cast (which is probably the preferred way).

Nutster commented: Quite right. I forgot about that. The generic Control needs to be cast to TextBox. +4
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The maximum size of a hard drive partition is not determined by the operating system (32 bit or 64 bit). It is determined by the file system. Thus, NTFS can manage a larger partition than FAT or FAT32. Whether the medium is solid state memory or magnetic platters is irrelevant.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

No. You don't.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If your textboxes are named TextBox1 through TextBix36 you can do

For i As Integer = 1 To 36
    Dim txt As TextBox = Me.Controls("TextBox" & i)
    txt.Text = "name" & i
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I threw together a test project. The form has ten textbox controls named TextBox1 through TextBox10. There is one button named btnSave. When the form loads it puts ten strings inito the ten textboxes. Clicking btnSave copies all of the text from the textboxes (in order of name) into a buffer, then writes the buffer to a text file.

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click

        Dim buffer As String = ""

        For i As Integer = 1 To 10
            Dim txt As TextBox = Me.Controls("TextBox" & i)
            buffer &= txt.Text & vbCrLf
        Next

        My.Computer.FileSystem.WriteAllText("d:\temp\save.txt", buffer, False)

    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        For i As Integer = 1 To 10
            Dim txt As TextBox = Me.Controls("TextBox" & i)
            txt.Text = "This is line " & i
        Next

    End Sub

End Class
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

And please provide details. For example, what is "Sample"? I'll assume that because you use Oledb in the title it is a database but you don't say what kind of database or provide some field names. Since you want to populate a listbox I can also infer that you expect more than one name to match. This generally means some type of wildcard search. So please provide somoe more information if you want a useful answer.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In order to simplify your code you might put the "please enter" text into the Tag property of each textbox, then you could write a generic routine that checks for blank fields. Something like

Private Function IsBlank (txt as TextBox)
    If txt.Text = "") Then
        MsgBox(txt.Tag)
        txt.Focus
        Return True
    End If

    Return False
End Sub

Then your posted code would look like

If IsBlank(txtname) Then Exit Sub
If IsBlank(txticno) Then Exit Sub
etc.

Or if you have all of the text fields collected in a groupbox you could do

For Each txt As TextBox In grpInput.Controls.OfType(Of TextBox)()
    If txt.Text = "" Then
        MsgBox(txt.Tag)
        txt.Focus()
        Exit Sub
    End If
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You need to change it to

cmd.CommandText = "UPDATE [" & EBU2DB_LOB & "] " _
                & "   SET Months  = ?," _
                & "       Brand   = ?," _
                & "       LOB     = ?," _
                & "       Revenue = ? " _
                & " WHERE GP      = ? "

cmd.Parameters.AddWithValue("@Months  ", .Combo_LOB_Month_Update.Text)
cmd.Parameters.AddWithValue("@Brand   ", .Combo_LOB_Brand_Update.Text)
cmd.Parameters.AddWithValue("@LOB     ", .Combo_LOB_LOB_Update.Text)
cmd.Parameters.AddWithValue("@Revenue ", .Text_LOB_Revenue_Update.Text)
cmd.Parameters.AddWithValue("@GP      ", .Text_LOB_GP_Update.Text)

I'm assuming that because your controls have a leading "." the code is isside a With block. Note how much easier it is to read the code when a few extra spaces makes the fields line up and by spreading out the query text over multiple lines.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Try this

Dim cmd As New OleDbCommand("", con)

cmd.CommandText = "DELETE FROM [" & EBU2DB_LOB & "] " _
                & " WHERE Brand  = ? " _
                & "   AND LOB    = ? " _
                & "   AND Months = ? "

cmd.Parameters.AddWithValue("@Brand ", Form_Month_End_Report.Combo_LOB_Brand.Text)
cmd.Parameters.AddWithValue("@LOB   ", Form_Month_End_Report.Combo_LOB_LOB.Text)
cmd.Parameters.AddWithValue("@Months", Form_Month_End_Report.Combo_LOB_Month.Text)

If MsgBox("Do you want to Delete?", MsgBoxStyle.YesNo, "Confirm") = MsgBoxResult.Yes Then
    If con.State = ConnectionState.Closed Then con.Open()
    cmd.ExecuteNonQuery()
End If
Begginnerdev commented: Yep. +8
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

is it okay if my provider is a access?

You'd need to modify the connection string but that should be it. As for the statement

"INSERT INTO myTable (Firstname,Middlename,Lastname) VALUES(?,?,?)"
                     |------------- 1 -------------|       |- 2 -|

Section 1 lists all of the fields in the record you are inserting. Section 2 lists the values you are inserting, or at least it would if you weren't using parameterized entry (which you should). A simple insert would be

"INSERT INTO myTable (Firstname,Middlename,Lastname) VALUES('Homer','J.','Simpson')"

but you don't want to hard code in actual values so we replace each value with ?, then add the actual values later with cmd.Parameters.AddWithValue

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Here's how to insert a new record.

Dim con As New OleDbConnection("Provider=SQLNCLI10;Server=.\SQLEXPRESS;Database=mydb;Trusted_Connection=Yes;")
Dim cmd As New OleDbCommand("", con)

cmd.CommandText = "INSERT INTO myTable (Firstname,Middlename,Lastname) VALUES(?,?,?)"
cmd.Parameters.AddWithValue("@FirstName ", Firstname.Text)
cmd.Parameters.AddWithValue("@MiddleName", Middlenameame.Text)
cmd.Parameters.AddWithValue("@LastName  ", Lastname.Text)

con.Open()
cmd.ExecuteNonQuery()
con.Close() 

An update query requires that you be able to identify a particular record first. For example, if you wanted to change the first and last names for a record with a specific last name you could code

Dim con As New OleDbConnection("Provider=SQLNCLI10;Server=.\SQLEXPRESS;Database=mydb;Trusted_Connection=Yes;")
Dim cmd As New OleDbCommand("", con)

cmd.CommandText = "UPDATE myTable         " _
                & "   SET Firstname  = ?, " _
                & "       Middlename = ?  " _
                & " WHERE Lastname   = ?"
cmd.Parameters.AddWithValue("@FirstName ", Firstname.Text)
cmd.Parameters.AddWithValue("@MiddleName", Middlename.Text)
cmd.Parameters.AddWithValue("@LastName  ", Lastname.Text)

con.Open()
cmd.ExecuteNonQuery()
con.Close()

Please note that when adding the parameter values, you must add the values in the same order in which they appear in the query. The symbolic names used (eg @Firstname) are not important. They are there for convenience. If you were to code

cmd.Parameters.AddWithValue("@LastName  ", Lastname.Text)
cmd.Parameters.AddWithValue("@MiddleName", Middlename.Text)
cmd.Parameters.AddWithValue("@FirstName ", Firstname.Text)

you would end up with the last and first names reversed. You could just as well code

cmd.Parameters.AddWithValue("@splunge", Firstname.Text)
cmd.Parameters.AddWithValue("@berferd", Middlename.Text)
cmd.Parameters.AddWithValue("@kumquat", Lastname.Text)

which is confusing but still gives you what you want. Not allowing named and positional parameters was, in my opinion, a serious brainfart on some designer's part. At least they got it right for Sql specific commands.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My Dad raised two bears from cubs. I only have dogs and cats but I enjoy the occasional glass of wine.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Just out of morbid curiousity, what 170 pieces of information could you possibly have that could not be broken down into sub-tables? I strongly recommend you reconsider your database design. Your queries are going to be horrendously difficult to code and maintain. It takes a lot less effort to change a database at design time than after it goes into service. And it this is for an assignment I can guarantee a poor grade.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Here's an oddball possibility. If you are moving the files from an NTFS device to a non NTFS device And If the missing data was being stored in alternate data streams then that data would not be copied with the files.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I try to strike a balance in my use of whitespace.

Ifindthattoolittlemakesthecodehardtoread and                        too                   much





can


also                   be                      a   

                        pain.
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

When you try to connect, the connection does not happen instantaneously. The connection timeout has to elapse before the attempt fails. The way to avoid the freezing is to put the code in a separate thread. However, with that approach you have to use a delegate to update your main form from the thread. Fortunately, that is not difficult and I have an example of how to do that here.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

vbScript had the functions, Execute and ExcecuteGlobal which allowed runtime execution of VB expressions (strings) with various levels of scoping. As I recall, this feature is not available in VB.net 2010 but might be have been restored in VB.net 2012. If you really need to execute dynamic code then you might look into VB 2012. If you don't mind handling the dynamic expressions yourself (ie maintaining your own symbol table) then TnTinMN's suggestion is likely your best bet.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Could be a codec problem. Try downloading gspot. It will try to process the file and will tell you if there is a problem with a codec (bad or missing). Try installing VLC Media Player. It's free and open source and can play just about anything.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you are using an oledb interface then you have to use "?" when adding values as in

'OLEDB is more generic (can be used for different data sources) and supports
'parameters but they are unnamed and positional

ListView1.Items.Clear()

Dim con As New OleDbConnection("Provider=SQLNCLI10;Server=.\SQLEXPRESS;Database=PUBS;Trusted_Connection=Yes;")
Dim cmd As New OleDbCommand("", con)

cmd.CommandText = "SELECT au_lname,au_fname,zip FROM authors WHERE au_lname like ?"
cmd.Parameters.Add("@pan", OleDbType.VarChar).Value = "D%"

con.Open()
Dim rdr As OleDbDataReader = cmd.ExecuteReader()

Do While rdr.Read
    ListView1.Items.Add(New ListViewItem({rdr.GetString(0), rdr.GetString(1), rdr.GetString(2)}))
Loop

rdr.Close()
con.Close()

OleDb does not support named parameters. You can see the difference between SqlClient and OleDb here. That's the same sample code I posted a link to just above.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Lately when I post a response that says "google it" I include an actual link that includes the google search phrase plus "site:www.daniweb.com". For example google SQL injection. If the user clicks on that link he/she is shown a list of threads on DaniWeb that address the particular question. The result is to ensure that the traffic is directed back to this website.

mike_2000_17 commented: Good idea! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You need to have single quotes around text fields. For example

INSERT INTO myTable (lname,fname) VALUES(Flintstone,Fred)

is not valid but

INSERT INTO myTable (lname,fname) VALUES('Flintstone','Fred')

is. Also, you should be using parameterized queries. It's not only more secure but it makes the code easier to read. See here for sample code.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can find sample code here

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can start by posting your question in the java forum instead of VB.Net. Consider it moved.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
List.Items(currentTimer - 1).SubItems(List.Items(currentTimer - 1).SubItems.Count).Text = ""

Will probably not work because Count will always return a number whic is one more than the highest valid index. Iitems and SubItems are zero-relative indexed so if you have 5 SubItems then then Count = 5 and the rightmost SubIitem has an index of 4.

Begginnerdev commented: Sorry for absence. +8
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm not sure why you do

AppendtxtCallNotesText()

when the next statement just undoes what you just did. Why not just do

Private Sub cbCallNotesPrefills_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbCallNotesPrefills.SelectedIndexChanged

    txtCallNotes.Text = cbCallNotesPrefills.Text

End Sub
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I can't see how that is in any way enforceable. Unfortunately, faced with outrageous legal costs to defend against a charge I can see most people settling out of court.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Hello Mistah Taylor. I'm not sure I understand. Do you want the string "Sample Text" to appear in the combo box and when the user selects it, text from a file gets copied to the textbox? Or do you want text from the file to be loaded into the combo box (instead of "Sample Text") and have that text copied to the textbox? In either case, you have to have the filename specified somewhere. Either way it is not complicated.

If you just want to copy the selected text then do

txtCallNotes.Text = cbCallNotesPrefills.Text

Just be a little more specific and I'll throw some code at you.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

For a second I thought you meant you listen to music on 8 Track. Does anyone even remember what an 8-Track tape is?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The format of an If statement is

If <expression> Then

where <expression is expected to be something that eventually boils down to a boolean. For example

If str = "abc" Then

the expression

str = "abc"

when evaluated results in either the value True or False. Your statement

If Me.TbmembersTableAdapter.ScalarQueryCardID(cardid) Then

does not result in a boolean value and generates the error because it cannot be converted to one.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My most interesting job was my second job after graduating. I worked in the Neuro-Science department of the University of Manitoba Medical College. I worked for two doctors doing research. The first was doing vestibular studies (balance, eye-hand coordination) on a grant for NASA and the other was doing spinal cord research with the hope of developing implants for people with spinal cord injuries. That was when 8080/8086 micro-computers were just becoming available so I got to get down and dirty with the hardware as well as the code. It was the only time I had to use a soldering gun on the job. It was cool getting in on the ground floor of the new technology but I wish I'd had the opportunities that Mike had.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Can anyone explain to me why it is illegal for me to download (or share) an mp3 via bittorrent when that same mp3 is freely available through youtube?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I have a wide field of musical interests. However, it completely excludes rap. Jazz and Country are only barely represented.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Why bother? Labels are by definition read-only.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Don't disable the label. Replace your code with

Dim lblPrtNo As New Label()
lblPrtNo.Name = "lblPrtNo"
lblPrtNo.Text = "Part Number"
lblPrtNo.BackColor = Color.DarkBlue
lblPrtNo.ForeColor = Color.White
lblPrtNo.Font = New Font("Sans Serif", 9, FontStyle.Bold)
lblPrtNo.Location = New Point(15, 56)
lblPrtNo.Size = New Size(77, 15)
pnlOrderLine.Controls.Add(lblPrtNo)

and it will work the way you want.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm playing with it right now. In the meantime I'll mention that you shouldn't add the controls to both the panel and form collections. The form contains the panel control and the panel control contains the label and text controls.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It depends what the relationship is. You can relate tables based on any field.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you want the controls in the panel then you have to add them to the panel controls collection instead of the form controls collection as in

pnlOrderEntry.Controls.Add(lblPrtNo)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I've never used the Friend declaration and I've never had a problem. I also don't use the With Events option. That doesn't mean I am doing it correctly.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Keep in mind that if you want to reference the controls other than from within the event handlers, you will need a variable to hold that reference. If you are creating an array of textboxes then Ii suggest you use an array to save the references. As tinstaafl says, declare the array at the class level as

Private TxtRefs(10) As TextBox
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

At line 34 you have

Me.Controls.Add(txbPartNo)

but you don't have an End Sub before the next statement. On my system (VB 2010), the statement

txbPartNo.TextAlign = ContentAlignment.MiddleLeft

is not valid. When I remove it and add the End Sub the code works fine. And just out of curiousity, why do you need a TextChanged event handler for a label control?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

6081

And not even one piece of (c)rap.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Try creating the two tables from my example above. EmployerID and EmployeeID are IDENTITY fields. You don't supply a value when you insert a new record. The value is generated by the database engine. You do, however, have to supply a value for EmployerID when you insert a new record into the Employee table. Because Employee.EmployerID was created with a foreign key constraint, any attempt to add an Employee record with a non-existing EmployerID will fail. A foreign key, therefore, cannot be NULL. The following command creats the constraint

ALTER TABLE [dbo].[Employee] WITH CHECK ADD CONSTRAINT [FK_Employee_Employer] FOREIGN KEY([EmployerID])
REFERENCES  [dbo].[Employer] ([EmployerID])
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Why do you have both EmployerID and IDEmployer in the Employee table and why do you allow NULLs in IDEmployer?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

For example. If I have two tables

USE [mydb]
GO

/****** Object:  Table [dbo].[Employer]    Script Date: 02/17/2013 06:40:14 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Employer](
    [EmployerID] [int] IDENTITY(1,1) NOT NULL,
    [LastName]   [varchar](50)       NOT NULL,
    [FirstName]  [varchar](50)       NOT NULL,
 CONSTRAINT [PK_Employer] PRIMARY KEY CLUSTERED 
(
    [EmployerID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

and

USE [mydb]
GO

/****** Object:  Table [dbo].[Employee]    Script Date: 02/17/2013 06:40:40 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Employee](
    [EmployeeID] [int] IDENTITY(1,1) NOT NULL,
    [LastName]   [varchar](50)       NOT NULL,
    [FirstName]  [varchar](50)       NOT NULL,
    [EmployerID] [int] NOT NULL,
 CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED 
(
    [EmployeeID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[Employee]  WITH CHECK ADD  CONSTRAINT [FK_Employee_Employer] FOREIGN KEY([EmployerID])
REFERENCES [dbo].[Employer] ([EmployerID])
GO

ALTER TABLE [dbo].[Employee] CHECK CONSTRAINT [FK_Employee_Employer]
GO

then I can do

SELECT Employer.FirstName,Employee.FirstName
  FROM Employer INNER JOIN Employee ON Employer.EmployerID = Employee.EmployerID

or

SELECT Employer.FirstName,Employee.FirstName
  FROM Employer,Employee
 WHERE Employer.EmployerID = Employee.EmployerID
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You have two fields in your Employee table. They both look (by name) like they contain the Employer ID. If you are going to show me the tables then please show all fields. Your primary key for the Employee table should not be EmployerID.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In order to relate two tables they have to have a common column. You'll have to include the EmployerID as a column in the Employee table. You described the tables as follows:

Employer Table:
I have two field
EmployerID (pk Key assigned to it)
Employee Table:
EmployerID(pk Key assigned to it)
IDEmployer(fk key assigned to it,and Allow Nulls:Checked)

You said the Employer table has two columns but I see only one. The Employee table has only two fields and both look like the EmployerID. Set the tables up as follows (add more columns as needed)

Employer
EmployerID (PK)
LastName
FirstName

Employee
EmployeeID (PK)
LastName
FirstName
EmployerID (FK)

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I could be wrong, but is'nt "Persist Security Info" a parameter for connecting to SQL Server and not an old Access mdb file?

That's why I asked what type of database was being accessed. If the parameter is not valid for that type of database then you can get the error.