hi im reinventing a code myself but when i tried to run it didnt work as expected. i dont want to copy all the one ive downloaded so i made it a smaller by reducing the control use and not using search command.
so heres my very simple code -
Private Sub loadrecord()
-
-
-
Dim conn As New OleDbConnection(Get_Constring)
-
Dim cmd As New OleDbCommand
-
Dim dr As OleDbDataReader
-
-
Try
-
conn.Open()
-
cmd.Connection = conn
-
cmd.CommandType = CommandType.Text
-
cmd.CommandText = "select id, First_Name, Last_Name from table1 where id= " & Me.txtFname.Tag
-
dr = cmd.ExecuteReader
-
-
-
-
If dr.HasRows Then
-
While dr.Read
-
Me.txtFname.Tag = dr("ID")
-
Me.txtFname.Text = IIf(Not IsDBNull(dr("First_name")), dr("First_name"), "")
-
Me.txtFname.Text = IIf(Not IsDBNull(dr("last_name")), dr("last_name"), "")
-
-
End While
-
-
-
End If
-
Catch ex As Exception
-
MsgBox(ErrorToString)
-
Finally
-
conn.Close()
-
End Try
-
-
-
-
-
End Sub
-
-
just to be honest with you, i dont understand the tag property there and some other stuff like the IIF and IsDBNull.
heres the source code i am using as my reference. -
Private Sub Load_Record()
-
Dim conn As New OleDbConnection
-
Dim cmd As New OleDbCommand
-
Dim dr As OleDbDataReader
-
-
Try
-
-
conn = New OleDbConnection(Get_Constring)
-
conn.Open()
-
cmd.Connection = conn
-
cmd.CommandType = CommandType.Text
-
cmd.CommandText = "select contact_id, last_name, first_name, mid_name, birth_date, gender, home_adr, bus_adr, tel_no, mobile_no, email from tblAddressBook where contact_id= " & Me.txtFirstName.Tag
-
-
dr = cmd.ExecuteReader
-
If dr.HasRows Then
-
While dr.Read
-
Me.txtFirstName.Tag = dr("contact_id")
-
Me.txtFirstName.Text = IIf(Not IsDBNull(dr("first_name")), dr("first_name"), "")
-
Me.txtLastName.Text = IIf(Not IsDBNull(dr("last_name")), dr("last_name"), "")
-
Me.txtMidName.Text = IIf(Not IsDBNull(dr("mid_name")), dr("mid_name"), "")
-
If Not IsDBNull(dr("birth_date")) Then
-
Me.dtpDOB.Format = DateTimePickerFormat.Short
-
Me.dtpDOB.Value = dr("birth_date")
-
End If
-
If Not IsDBNull(dr("gender")) Then
-
If dr("gender") = 1 Then
-
Me.optMale.Checked = True
-
Else
-
Me.optFemale.Checked = True
-
End If
-
End If
-
Me.txtHomeAdr.Text = IIf(Not IsDBNull(dr("home_adr")), dr("home_adr"), "")
-
Me.txtBusAdr.Text = IIf(Not IsDBNull(dr("bus_adr")), dr("bus_adr"), "")
-
Me.txtTelNo.Text = IIf(Not IsDBNull(dr("tel_no")), dr("tel_no"), "")
-
Me.txtMobNo.Text = IIf(Not IsDBNull(dr("mobile_no")), dr("mobile_no"), "")
-
Me.txtEmail.Text = IIf(Not IsDBNull(dr("email")), dr("email"), "")
-
End While
-
End If
-
-
Catch ex As Exception
-
MsgBox(ErrorToString)
-
Finally
-
conn.Close()
-
End Try
-
End Sub
-
-
-
Thanks . ill be attaching my sample work here.
1 1145 Sign in to post your reply or Sign up for a free account.
Similar topics
by: shank |
last post by:
1) I'm getting this error: Syntax error (missing operator) in query
expression on the below statement. Can I get some advice.
2) I searched ASPFAQ and came up blank. Where can find the "rules"...
|
by: Mark |
last post by:
Hi - I can get this to work in SQL Server - but when also trying to make
the application compatible with MS Access I get an error:
Select tblfaqnetgroups.group_name from tblfaqnetroles
Inner...
|
by: dcarson |
last post by:
I've read about this error in several other discussions, but still
can't seem to pinpoint the problem with my code. Everything seemed to
be working fine for some time, but it now tends to bomb out...
|
by: Alan Murrell |
last post by:
Hello,
One of our web hosting clients is getting the following error when
someone tried to log in form their login page:
--- ODBC ERROR ---
Microsoft OLE DB Provider for ODBC Drivers error...
|
by: khan |
last post by:
getting, error, 3075
Syntax Error (Missing Operator) in query expression '8WHERE
.=1'
Dim TotalQty As Integer
TotalQty = DLookup("", "", "=" &
Forms!!)
|
by: chug |
last post by:
I'm not a programmer but it's my job to solve this. Can someone help me
with this error message?
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
Syntax error (missing
operator)...
|
by: access baby |
last post by:
I hava a date parameter filter query but it shows error Syntax error
missing operator in query experssion
can some one please help where am i going wrong in expression
SELECT copyorderdtl * ...
|
by: Margie |
last post by:
Working on my database I use a modified piece of code gotten from thescripts. The code works perfectly except for one thing. When entering data containing the character ' , I get the error: Syntac...
|
by: Dilip Krishnan |
last post by:
Syntax error (missing operator) in query expression 'Serial Number = 'L3FW341''.
The Serial Number field is declared as text in Access Db.
I am not sure which operator is missing in my command!
...
|
by: pptechs |
last post by:
Hello. In dying need of assistance. All I am trying to do is search a table for a valid user ID for a form login screen and I am getting error :
"Run-time error 3075 syntax error (missing...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |