Error 49 Invalid use of null

Obeng

Registered User.
Local time
Today, 14:49
Joined
Nov 11, 2010
Messages
11
I am trying to insert bound images in my database but when I am about to create a new record I get Invalid use of Null below are my codes and I am just new to Vb so please take your time. Thank you in advance.

Private Sub Command44_Click()




End Sub

Private Sub Command51_Click()

End Sub

Private Sub Form_Current()
staffImage.Picture = Image
If IsNull(staffImage) Then
staffImage.Visible = False
Else
staffImage.Visible = True
End If



End Sub

Private Sub Form_Load()
UserName = Null
UserName.Visible = True
Login.Visible = True
ID.Visible = False
RegdNo.Visible = False
FirstName.Visible = False
MiddleName.Visible = False
LastName.Visible = False
Sex.Visible = False
DateofBirth.Visible = False
DateofAppointment.Visible = False
staffImage.Visible = False
Image.Visible = False
Grade.Visible = False
DateConfirmed.Visible = False
Hometown.Visible = False
Address.Visible = False
NextOfKin.Visible = False
MaritalStatus.Visible = False
ParticularsofChildren.Visible = False
AcademicQualifiication.Visible = False
LanguagesSpoken.Visible = False
ProfessionalQualification.Visible = False
Promotions.Visible = False
AddrofStation.Visible = False
PresentSalary.Visible = False
ChangeofName.Visible = False
ParticularsOfPostings.Visible = False



End Sub

Private Sub Image_Click()



End Sub

Private Sub Login_Click()
If [UserName] = "Obeng" Then
UserName.Visible = False
Login.Visible = True
ID.Visible = True
RegdNo.Visible = True
FirstName.Visible = True
MiddleName.Visible = True
LastName.Visible = True
Sex.Visible = True
DateofBirth.Visible = True
DateofAppointment.Visible = True
staffImage.Visible = True
Image.Visible = True
Grade.Visible = True
DateConfirmed.Visible = True
Hometown.Visible = True
Address.Visible = True
NextOfKin.Visible = True
MaritalStatus.Visible = True
ParticularsofChildren.Visible = True
AcademicQualifiication.Visible = True
LanguagesSpoken.Visible = True
ProfessionalQualification.Visible = True
Promotions.Visible = True
AddrofStation.Visible = True
PresentSalary.Visible = True
ChangeofName.Visible = True
ParticularsOfPostings.Visible = True
Else
x = MsgBox("You have entered an invalid Username", 16, "Invalid UserName")
End If
End Sub


Private Sub UserName_AfterUpdate()
Login.SetFocus


End Sub

Private Sub UserName_Enter()

End Sub
 
I'm guessing it highlights form_current when the error message comes up? My first guess is that you need to add a data member to staffimage:
Code:
[COLOR=#ff0000]If IsNull(staffImage[B].Picture[/B]) Then
[/COLOR]
 
Thanks a lot James, you are absolutely right, I tried with the if and then conditionals, it worked alright however the pictures can't change from record to record, the are static, could you please help me with the codes?
 
Hey guys I changed the control source to image and everything works fine except on an empty record the picture is still there, any help would be appreciated
 
I think the best thing to try is something different in the form_current. Store the path to the image in a field in the table that the form is based on, then:
Code:
Sub form_current()
 
[insert image object name here].picture=me.[image path field in table here]
 
End Sub
This is all guesswork but I would imagine when you move to a new record, and the image path field is blank, there won't be a picture.
 
Thanks a lot James, I really appreciate your help and effort, since my database is mainly for my organisation that is Ghana Education Service, I thought instead of going through the strains of this imaghing thing wouldn't it be better if I created a browse button for my users to browse for the required picture, could you help with creating a browse button based on the codes above?
 

Users who are viewing this thread

Back
Top Bottom